
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>10. API Reference &#8212; Python 3.6.3 documentation</title>
    <link rel="stylesheet" href="../_static/pydoctheme.css" type="text/css" />
    <link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
    <script type="text/javascript">
      var DOCUMENTATION_OPTIONS = {
        URL_ROOT:    '../',
        VERSION:     '3.6.3',
        COLLAPSE_INDEX: false,
        FILE_SUFFIX: '.html',
        HAS_SOURCE:  true,
        SOURCELINK_SUFFIX: '.txt'
      };
    </script>
    <script type="text/javascript" src="../_static/jquery.js"></script>
    <script type="text/javascript" src="../_static/underscore.js"></script>
    <script type="text/javascript" src="../_static/doctools.js"></script>
    <script type="text/javascript" src="../_static/sidebar.js"></script>
    <link rel="search" type="application/opensearchdescription+xml"
          title="Search within Python 3.6.3 documentation"
          href="../_static/opensearch.xml"/>
    <link rel="author" title="About these documents" href="../about.html" />
    <link rel="index" title="Index" href="../genindex.html" />
    <link rel="search" title="Search" href="../search.html" />
    <link rel="copyright" title="Copyright" href="../copyright.html" />
    <link rel="next" title="Installing Python Modules (Legacy version)" href="../install/index.html" />
    <link rel="prev" title="9. Command Reference" href="commandref.html" />
    <link rel="shortcut icon" type="image/png" href="../_static/py.png" />
    <link rel="canonical" href="https://docs.python.org/3/distutils/apiref.html" />
    
    <script type="text/javascript" src="../_static/copybutton.js"></script>
    <script type="text/javascript" src="../_static/switchers.js"></script>
    
    
 

  </head>
  <body>  
    <div class="related" role="navigation" aria-label="related navigation">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="../genindex.html" title="General Index"
             accesskey="I">index</a></li>
        <li class="right" >
          <a href="../py-modindex.html" title="Python Module Index"
             >modules</a> |</li>
        <li class="right" >
          <a href="../install/index.html" title="Installing Python Modules (Legacy version)"
             accesskey="N">next</a> |</li>
        <li class="right" >
          <a href="commandref.html" title="9. Command Reference"
             accesskey="P">previous</a> |</li>
        <li><img src="../_static/py.png" alt=""
                 style="vertical-align: middle; margin-top: -1px"/></li>
        <li><a href="https://www.python.org/">Python</a> &#187;</li>
        <li>
          <span class="language_switcher_placeholder">en</span>
          <span class="version_switcher_placeholder">3.6.3</span>
          <a href="../index.html">Documentation </a> &#187;
        </li>

          <li class="nav-item nav-item-1"><a href="index.html" accesskey="U">Distributing Python Modules (Legacy version)</a> &#187;</li>
    <li class="right">
        

    <div class="inline-search" style="display: none" role="search">
        <form class="inline-search" action="../search.html" method="get">
          <input placeholder="Quick search" type="text" name="q" />
          <input type="submit" value="Go" />
          <input type="hidden" name="check_keywords" value="yes" />
          <input type="hidden" name="area" value="default" />
        </form>
    </div>
    <script type="text/javascript">$('.inline-search').show(0);</script>
         |
    </li>

      </ul>
    </div>    

    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body" role="main">
            
  <div class="section" id="api-reference">
<span id="id1"></span><h1>10. API Reference<a class="headerlink" href="#api-reference" title="Permalink to this headline">¶</a></h1>
<div class="section" id="module-distutils.core">
<span id="distutils-core-core-distutils-functionality"></span><h2>10.1. <a class="reference internal" href="#module-distutils.core" title="distutils.core: The core Distutils functionality"><code class="xref py py-mod docutils literal"><span class="pre">distutils.core</span></code></a> — Core Distutils functionality<a class="headerlink" href="#module-distutils.core" title="Permalink to this headline">¶</a></h2>
<p>The <a class="reference internal" href="#module-distutils.core" title="distutils.core: The core Distutils functionality"><code class="xref py py-mod docutils literal"><span class="pre">distutils.core</span></code></a> module is the only module that needs to be installed
to use the Distutils. It provides the <a class="reference internal" href="#distutils.core.setup" title="distutils.core.setup"><code class="xref py py-func docutils literal"><span class="pre">setup()</span></code></a> (which is called from the
setup script). Indirectly provides the  <code class="xref py py-class docutils literal"><span class="pre">distutils.dist.Distribution</span></code> and
<a class="reference internal" href="#distutils.cmd.Command" title="distutils.cmd.Command"><code class="xref py py-class docutils literal"><span class="pre">distutils.cmd.Command</span></code></a> class.</p>
<dl class="function">
<dt id="distutils.core.setup">
<code class="descclassname">distutils.core.</code><code class="descname">setup</code><span class="sig-paren">(</span><em>arguments</em><span class="sig-paren">)</span><a class="headerlink" href="#distutils.core.setup" title="Permalink to this definition">¶</a></dt>
<dd><p>The basic do-everything function that does most everything you could ever ask
for from a Distutils method.</p>
<p>The setup function takes a large number of arguments. These are laid out in the
following table.</p>
<table border="1" class="docutils">
<colgroup>
<col width="18%" />
<col width="28%" />
<col width="54%" />
</colgroup>
<thead valign="bottom">
<tr class="row-odd"><th class="head">argument name</th>
<th class="head">value</th>
<th class="head">type</th>
</tr>
</thead>
<tbody valign="top">
<tr class="row-even"><td><em>name</em></td>
<td>The name of the package</td>
<td>a string</td>
</tr>
<tr class="row-odd"><td><em>version</em></td>
<td>The version number of the
package; see
<a class="reference internal" href="#module-distutils.version" title="distutils.version: implements classes that represent module version numbers."><code class="xref py py-mod docutils literal"><span class="pre">distutils.version</span></code></a></td>
<td>a string</td>
</tr>
<tr class="row-even"><td><em>description</em></td>
<td>A single line describing the
package</td>
<td>a string</td>
</tr>
<tr class="row-odd"><td><em>long_description</em></td>
<td>Longer description of the
package</td>
<td>a string</td>
</tr>
<tr class="row-even"><td><em>author</em></td>
<td>The name of the package author</td>
<td>a string</td>
</tr>
<tr class="row-odd"><td><em>author_email</em></td>
<td>The email address of the
package author</td>
<td>a string</td>
</tr>
<tr class="row-even"><td><em>maintainer</em></td>
<td>The name of the current
maintainer, if different from
the author. Note that if
the maintainer is provided,
distutils will use it as the
author in <code class="file docutils literal"><span class="pre">PKG-INFO</span></code></td>
<td>a string</td>
</tr>
<tr class="row-odd"><td><em>maintainer_email</em></td>
<td>The email address of the
current maintainer, if
different from the author</td>
<td>a string</td>
</tr>
<tr class="row-even"><td><em>url</em></td>
<td>A URL for the package
(homepage)</td>
<td>a string</td>
</tr>
<tr class="row-odd"><td><em>download_url</em></td>
<td>A URL to download the package</td>
<td>a string</td>
</tr>
<tr class="row-even"><td><em>packages</em></td>
<td>A list of Python packages that
distutils will manipulate</td>
<td>a list of strings</td>
</tr>
<tr class="row-odd"><td><em>py_modules</em></td>
<td>A list of Python modules that
distutils will manipulate</td>
<td>a list of strings</td>
</tr>
<tr class="row-even"><td><em>scripts</em></td>
<td>A list of standalone script
files to be built and
installed</td>
<td>a list of strings</td>
</tr>
<tr class="row-odd"><td><em>ext_modules</em></td>
<td>A list of Python extensions to
be built</td>
<td>a list of instances of
<a class="reference internal" href="#distutils.core.Extension" title="distutils.core.Extension"><code class="xref py py-class docutils literal"><span class="pre">distutils.core.Extension</span></code></a></td>
</tr>
<tr class="row-even"><td><em>classifiers</em></td>
<td>A list of categories for the
package</td>
<td>a list of strings; valid classifiers are listed on <a class="reference external" href="https://pypi.python.org/pypi?:action=list_classifiers">PyPI</a>.</td>
</tr>
<tr class="row-odd"><td><em>distclass</em></td>
<td>the <a class="reference internal" href="#distutils.core.Distribution" title="distutils.core.Distribution"><code class="xref py py-class docutils literal"><span class="pre">Distribution</span></code></a>
class to use</td>
<td>a subclass of
<a class="reference internal" href="#distutils.core.Distribution" title="distutils.core.Distribution"><code class="xref py py-class docutils literal"><span class="pre">distutils.core.Distribution</span></code></a></td>
</tr>
<tr class="row-even"><td><em>script_name</em></td>
<td>The name of the setup.py
script - defaults to
<code class="docutils literal"><span class="pre">sys.argv[0]</span></code></td>
<td>a string</td>
</tr>
<tr class="row-odd"><td><em>script_args</em></td>
<td>Arguments to supply to the
setup script</td>
<td>a list of strings</td>
</tr>
<tr class="row-even"><td><em>options</em></td>
<td>default options for the setup
script</td>
<td>a dictionary</td>
</tr>
<tr class="row-odd"><td><em>license</em></td>
<td>The license for the package</td>
<td>a string</td>
</tr>
<tr class="row-even"><td><em>keywords</em></td>
<td>Descriptive meta-data, see
<span class="target" id="index-0"></span><a class="pep reference external" href="https://www.python.org/dev/peps/pep-0314"><strong>PEP 314</strong></a></td>
<td>a list of strings or a comma-separated string</td>
</tr>
<tr class="row-odd"><td><em>platforms</em></td>
<td>&#160;</td>
<td>a list of strings or a comma-separated string</td>
</tr>
<tr class="row-even"><td><em>cmdclass</em></td>
<td>A mapping of command names to
<a class="reference internal" href="#distutils.core.Command" title="distutils.core.Command"><code class="xref py py-class docutils literal"><span class="pre">Command</span></code></a> subclasses</td>
<td>a dictionary</td>
</tr>
<tr class="row-odd"><td><em>data_files</em></td>
<td>A list of data files to
install</td>
<td>a list</td>
</tr>
<tr class="row-even"><td><em>package_dir</em></td>
<td>A mapping of package to
directory names</td>
<td>a dictionary</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="distutils.core.run_setup">
<code class="descclassname">distutils.core.</code><code class="descname">run_setup</code><span class="sig-paren">(</span><em>script_name</em><span class="optional">[</span>, <em>script_args=None</em>, <em>stop_after='run'</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#distutils.core.run_setup" title="Permalink to this definition">¶</a></dt>
<dd><p>Run a setup script in a somewhat controlled environment, and return  the
<code class="xref py py-class docutils literal"><span class="pre">distutils.dist.Distribution</span></code> instance that drives things.   This is
useful if you need to find out the distribution meta-data  (passed as keyword
args from <em>script</em> to <a class="reference internal" href="#distutils.core.setup" title="distutils.core.setup"><code class="xref py py-func docutils literal"><span class="pre">setup()</span></code></a>), or  the contents of the config files or
command-line.</p>
<p><em>script_name</em> is a file that will be read and run with <a class="reference internal" href="../library/functions.html#exec" title="exec"><code class="xref py py-func docutils literal"><span class="pre">exec()</span></code></a>.  <code class="docutils literal"><span class="pre">sys.argv[0]</span></code>
will be replaced with <em>script</em> for the duration of the call.  <em>script_args</em> is a
list of strings; if supplied, <code class="docutils literal"><span class="pre">sys.argv[1:]</span></code> will be replaced by <em>script_args</em>
for the duration  of the call.</p>
<p><em>stop_after</em> tells <a class="reference internal" href="#distutils.core.setup" title="distutils.core.setup"><code class="xref py py-func docutils literal"><span class="pre">setup()</span></code></a> when to stop processing; possible  values:</p>
<table border="1" class="docutils">
<colgroup>
<col width="25%" />
<col width="75%" />
</colgroup>
<thead valign="bottom">
<tr class="row-odd"><th class="head">value</th>
<th class="head">description</th>
</tr>
</thead>
<tbody valign="top">
<tr class="row-even"><td><em>init</em></td>
<td>Stop after the <a class="reference internal" href="#distutils.core.Distribution" title="distutils.core.Distribution"><code class="xref py py-class docutils literal"><span class="pre">Distribution</span></code></a>
instance has been created  and populated
with the keyword arguments to <a class="reference internal" href="#distutils.core.setup" title="distutils.core.setup"><code class="xref py py-func docutils literal"><span class="pre">setup()</span></code></a></td>
</tr>
<tr class="row-odd"><td><em>config</em></td>
<td>Stop after config files have been parsed
(and their data stored in the
<a class="reference internal" href="#distutils.core.Distribution" title="distutils.core.Distribution"><code class="xref py py-class docutils literal"><span class="pre">Distribution</span></code></a> instance)</td>
</tr>
<tr class="row-even"><td><em>commandline</em></td>
<td>Stop after the command-line
(<code class="docutils literal"><span class="pre">sys.argv[1:]</span></code> or  <em>script_args</em>) have
been parsed (and the data stored in the
<a class="reference internal" href="#distutils.core.Distribution" title="distutils.core.Distribution"><code class="xref py py-class docutils literal"><span class="pre">Distribution</span></code></a> instance.)</td>
</tr>
<tr class="row-odd"><td><em>run</em></td>
<td>Stop after all commands have been run (the
same as  if <a class="reference internal" href="#distutils.core.setup" title="distutils.core.setup"><code class="xref py py-func docutils literal"><span class="pre">setup()</span></code></a> had been called
in the usual way). This is the default
value.</td>
</tr>
</tbody>
</table>
</dd></dl>

<p>In addition, the <a class="reference internal" href="#module-distutils.core" title="distutils.core: The core Distutils functionality"><code class="xref py py-mod docutils literal"><span class="pre">distutils.core</span></code></a> module exposed a number of  classes that
live elsewhere.</p>
<ul class="simple">
<li><code class="xref py py-class docutils literal"><span class="pre">Extension</span></code> from <a class="reference internal" href="#module-distutils.extension" title="distutils.extension: Provides the Extension class, used to describe C/C++ extension modules in setup scripts"><code class="xref py py-mod docutils literal"><span class="pre">distutils.extension</span></code></a></li>
<li><a class="reference internal" href="#distutils.cmd.Command" title="distutils.cmd.Command"><code class="xref py py-class docutils literal"><span class="pre">Command</span></code></a> from <a class="reference internal" href="#module-distutils.cmd" title="distutils.cmd: This module provides the abstract base class Command. This class is subclassed by the modules in the distutils.command subpackage."><code class="xref py py-mod docutils literal"><span class="pre">distutils.cmd</span></code></a></li>
<li><code class="xref py py-class docutils literal"><span class="pre">Distribution</span></code> from <a class="reference internal" href="#module-distutils.dist" title="distutils.dist: Provides the Distribution class, which represents the module distribution being built/installed/distributed"><code class="xref py py-mod docutils literal"><span class="pre">distutils.dist</span></code></a></li>
</ul>
<p>A short description of each of these follows, but see the relevant module for
the full reference.</p>
<dl class="class">
<dt id="distutils.core.Extension">
<em class="property">class </em><code class="descclassname">distutils.core.</code><code class="descname">Extension</code><a class="headerlink" href="#distutils.core.Extension" title="Permalink to this definition">¶</a></dt>
<dd><p>The Extension class describes a single C or C++ extension module in a setup
script. It accepts the following keyword arguments in its constructor:</p>
<table border="1" class="docutils">
<colgroup>
<col width="29%" />
<col width="39%" />
<col width="33%" />
</colgroup>
<thead valign="bottom">
<tr class="row-odd"><th class="head">argument name</th>
<th class="head">value</th>
<th class="head">type</th>
</tr>
</thead>
<tbody valign="top">
<tr class="row-even"><td><em>name</em></td>
<td>the full name of the
extension, including any
packages — ie. <em>not</em> a
filename or pathname, but
Python dotted name</td>
<td>a string</td>
</tr>
<tr class="row-odd"><td><em>sources</em></td>
<td>list of source filenames,
relative to the distribution
root (where the setup script
lives), in Unix form (slash-
separated) for portability.
Source files may be C, C++,
SWIG (.i), platform-specific
resource files, or whatever
else is recognized by the
<strong class="command">build_ext</strong> command
as source for a Python
extension.</td>
<td>a list of strings</td>
</tr>
<tr class="row-even"><td><em>include_dirs</em></td>
<td>list of directories to search
for C/C++ header files (in
Unix form for portability)</td>
<td>a list of strings</td>
</tr>
<tr class="row-odd"><td><em>define_macros</em></td>
<td>list of macros to define; each
macro is defined using a
2-tuple <code class="docutils literal"><span class="pre">(name,</span> <span class="pre">value)</span></code>,
where <em>value</em> is
either the string to define it
to or <code class="docutils literal"><span class="pre">None</span></code> to define it
without a particular value
(equivalent of <code class="docutils literal"><span class="pre">#define</span> <span class="pre">FOO</span></code>
in source or <code class="xref std std-option docutils literal"><span class="pre">-DFOO</span></code>
on Unix C compiler command
line)</td>
<td>a list of tuples</td>
</tr>
<tr class="row-even"><td><em>undef_macros</em></td>
<td>list of macros to undefine
explicitly</td>
<td>a list of strings</td>
</tr>
<tr class="row-odd"><td><em>library_dirs</em></td>
<td>list of directories to search
for C/C++ libraries at link
time</td>
<td>a list of strings</td>
</tr>
<tr class="row-even"><td><em>libraries</em></td>
<td>list of library names (not
filenames or paths) to link
against</td>
<td>a list of strings</td>
</tr>
<tr class="row-odd"><td><em>runtime_library_dirs</em></td>
<td>list of directories to search
for C/C++ libraries at run
time (for shared extensions,
this is when the extension is
loaded)</td>
<td>a list of strings</td>
</tr>
<tr class="row-even"><td><em>extra_objects</em></td>
<td>list of extra files to link
with (eg. object files not
implied by ‘sources’, static
library that must be
explicitly specified, binary
resource files, etc.)</td>
<td>a list of strings</td>
</tr>
<tr class="row-odd"><td><em>extra_compile_args</em></td>
<td>any extra platform- and
compiler-specific information
to use when compiling the
source files in ‘sources’. For
platforms and compilers where
a command line makes sense,
this is typically a list of
command-line arguments, but
for other platforms it could
be anything.</td>
<td>a list of strings</td>
</tr>
<tr class="row-even"><td><em>extra_link_args</em></td>
<td>any extra platform- and
compiler-specific information
to use when linking object
files together to create the
extension (or to create a new
static Python interpreter).
Similar interpretation as for
‘extra_compile_args’.</td>
<td>a list of strings</td>
</tr>
<tr class="row-odd"><td><em>export_symbols</em></td>
<td>list of symbols to be exported
from a shared extension. Not
used on all platforms, and not
generally necessary for Python
extensions, which typically
export exactly one symbol:
<code class="docutils literal"><span class="pre">init</span></code> + extension_name.</td>
<td>a list of strings</td>
</tr>
<tr class="row-even"><td><em>depends</em></td>
<td>list of files that the
extension depends on</td>
<td>a list of strings</td>
</tr>
<tr class="row-odd"><td><em>language</em></td>
<td>extension language (i.e.
<code class="docutils literal"><span class="pre">'c'</span></code>, <code class="docutils literal"><span class="pre">'c++'</span></code>,
<code class="docutils literal"><span class="pre">'objc'</span></code>). Will be detected
from the source extensions if
not provided.</td>
<td>a string</td>
</tr>
<tr class="row-even"><td><em>optional</em></td>
<td>specifies that a build failure
in the extension should not
abort the build process, but
simply skip the extension.</td>
<td>a boolean</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="class">
<dt id="distutils.core.Distribution">
<em class="property">class </em><code class="descclassname">distutils.core.</code><code class="descname">Distribution</code><a class="headerlink" href="#distutils.core.Distribution" title="Permalink to this definition">¶</a></dt>
<dd><p>A <a class="reference internal" href="#distutils.core.Distribution" title="distutils.core.Distribution"><code class="xref py py-class docutils literal"><span class="pre">Distribution</span></code></a> describes how to build, install and package up a Python
software package.</p>
<p>See the <a class="reference internal" href="#distutils.core.setup" title="distutils.core.setup"><code class="xref py py-func docutils literal"><span class="pre">setup()</span></code></a> function for a list of keyword arguments accepted  by the
Distribution constructor. <a class="reference internal" href="#distutils.core.setup" title="distutils.core.setup"><code class="xref py py-func docutils literal"><span class="pre">setup()</span></code></a> creates a Distribution instance.</p>
</dd></dl>

<dl class="class">
<dt id="distutils.core.Command">
<em class="property">class </em><code class="descclassname">distutils.core.</code><code class="descname">Command</code><a class="headerlink" href="#distutils.core.Command" title="Permalink to this definition">¶</a></dt>
<dd><p>A <a class="reference internal" href="#distutils.core.Command" title="distutils.core.Command"><code class="xref py py-class docutils literal"><span class="pre">Command</span></code></a> class (or rather, an instance of one of its subclasses)
implement a single distutils command.</p>
</dd></dl>

</div>
<div class="section" id="module-distutils.ccompiler">
<span id="distutils-ccompiler-ccompiler-base-class"></span><h2>10.2. <a class="reference internal" href="#module-distutils.ccompiler" title="distutils.ccompiler: Abstract CCompiler class"><code class="xref py py-mod docutils literal"><span class="pre">distutils.ccompiler</span></code></a> — CCompiler base class<a class="headerlink" href="#module-distutils.ccompiler" title="Permalink to this headline">¶</a></h2>
<p>This module provides the abstract base class for the <a class="reference internal" href="#distutils.ccompiler.CCompiler" title="distutils.ccompiler.CCompiler"><code class="xref py py-class docutils literal"><span class="pre">CCompiler</span></code></a>
classes.  A <a class="reference internal" href="#distutils.ccompiler.CCompiler" title="distutils.ccompiler.CCompiler"><code class="xref py py-class docutils literal"><span class="pre">CCompiler</span></code></a> instance can be used for all the compile  and
link steps needed to build a single project. Methods are provided to  set
options for the compiler — macro definitions, include directories,  link path,
libraries and the like.</p>
<p>This module provides the following functions.</p>
<dl class="function">
<dt id="distutils.ccompiler.gen_lib_options">
<code class="descclassname">distutils.ccompiler.</code><code class="descname">gen_lib_options</code><span class="sig-paren">(</span><em>compiler</em>, <em>library_dirs</em>, <em>runtime_library_dirs</em>, <em>libraries</em><span class="sig-paren">)</span><a class="headerlink" href="#distutils.ccompiler.gen_lib_options" title="Permalink to this definition">¶</a></dt>
<dd><p>Generate linker options for searching library directories and linking with
specific libraries.  <em>libraries</em> and <em>library_dirs</em> are, respectively, lists of
library names (not filenames!) and search directories.  Returns a list of
command-line options suitable for use with some compiler (depending on the two
format strings passed in).</p>
</dd></dl>

<dl class="function">
<dt id="distutils.ccompiler.gen_preprocess_options">
<code class="descclassname">distutils.ccompiler.</code><code class="descname">gen_preprocess_options</code><span class="sig-paren">(</span><em>macros</em>, <em>include_dirs</em><span class="sig-paren">)</span><a class="headerlink" href="#distutils.ccompiler.gen_preprocess_options" title="Permalink to this definition">¶</a></dt>
<dd><p>Generate C pre-processor options (<code class="xref std std-option docutils literal"><span class="pre">-D</span></code>, <code class="xref std std-option docutils literal"><span class="pre">-U</span></code>, <code class="xref std std-option docutils literal"><span class="pre">-I</span></code>) as
used by at least two types of compilers: the typical Unix compiler and Visual
C++. <em>macros</em> is the usual thing, a list of 1- or 2-tuples, where <code class="docutils literal"><span class="pre">(name,)</span></code>
means undefine (<code class="xref std std-option docutils literal"><span class="pre">-U</span></code>) macro <em>name</em>, and <code class="docutils literal"><span class="pre">(name,</span> <span class="pre">value)</span></code> means define
(<code class="xref std std-option docutils literal"><span class="pre">-D</span></code>) macro <em>name</em> to <em>value</em>.  <em>include_dirs</em> is just a list of
directory names to be added to the header file search path (<code class="xref std std-option docutils literal"><span class="pre">-I</span></code>).
Returns a list of command-line options suitable for either Unix compilers or
Visual C++.</p>
</dd></dl>

<dl class="function">
<dt id="distutils.ccompiler.get_default_compiler">
<code class="descclassname">distutils.ccompiler.</code><code class="descname">get_default_compiler</code><span class="sig-paren">(</span><em>osname</em>, <em>platform</em><span class="sig-paren">)</span><a class="headerlink" href="#distutils.ccompiler.get_default_compiler" title="Permalink to this definition">¶</a></dt>
<dd><p>Determine the default compiler to use for the given platform.</p>
<p><em>osname</em> should be one of the standard Python OS names (i.e. the ones returned
by <code class="docutils literal"><span class="pre">os.name</span></code>) and <em>platform</em> the common value returned by <code class="docutils literal"><span class="pre">sys.platform</span></code> for
the platform in question.</p>
<p>The default values are <code class="docutils literal"><span class="pre">os.name</span></code> and <code class="docutils literal"><span class="pre">sys.platform</span></code> in case the parameters
are not given.</p>
</dd></dl>

<dl class="function">
<dt id="distutils.ccompiler.new_compiler">
<code class="descclassname">distutils.ccompiler.</code><code class="descname">new_compiler</code><span class="sig-paren">(</span><em>plat=None</em>, <em>compiler=None</em>, <em>verbose=0</em>, <em>dry_run=0</em>, <em>force=0</em><span class="sig-paren">)</span><a class="headerlink" href="#distutils.ccompiler.new_compiler" title="Permalink to this definition">¶</a></dt>
<dd><p>Factory function to generate an instance of some CCompiler subclass for the
supplied platform/compiler combination. <em>plat</em> defaults to <code class="docutils literal"><span class="pre">os.name</span></code> (eg.
<code class="docutils literal"><span class="pre">'posix'</span></code>, <code class="docutils literal"><span class="pre">'nt'</span></code>), and <em>compiler</em>  defaults to the default compiler for
that platform. Currently only <code class="docutils literal"><span class="pre">'posix'</span></code> and <code class="docutils literal"><span class="pre">'nt'</span></code> are supported, and the
default compilers are “traditional Unix interface” (<code class="xref py py-class docutils literal"><span class="pre">UnixCCompiler</span></code>
class) and Visual C++ (<code class="xref py py-class docutils literal"><span class="pre">MSVCCompiler</span></code> class).  Note that it’s perfectly
possible to ask for a Unix compiler object under Windows, and a Microsoft
compiler object under Unix—if you supply a value for <em>compiler</em>, <em>plat</em> is
ignored.</p>
</dd></dl>

<dl class="function">
<dt id="distutils.ccompiler.show_compilers">
<code class="descclassname">distutils.ccompiler.</code><code class="descname">show_compilers</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#distutils.ccompiler.show_compilers" title="Permalink to this definition">¶</a></dt>
<dd><p>Print list of available compilers (used by the <code class="xref std std-option docutils literal"><span class="pre">--help-compiler</span></code> options
to <strong class="command">build</strong>, <strong class="command">build_ext</strong>, <strong class="command">build_clib</strong>).</p>
</dd></dl>

<dl class="class">
<dt id="distutils.ccompiler.CCompiler">
<em class="property">class </em><code class="descclassname">distutils.ccompiler.</code><code class="descname">CCompiler</code><span class="sig-paren">(</span><span class="optional">[</span><em>verbose=0</em>, <em>dry_run=0</em>, <em>force=0</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#distutils.ccompiler.CCompiler" title="Permalink to this definition">¶</a></dt>
<dd><p>The abstract base class <a class="reference internal" href="#distutils.ccompiler.CCompiler" title="distutils.ccompiler.CCompiler"><code class="xref py py-class docutils literal"><span class="pre">CCompiler</span></code></a> defines the interface that  must be
implemented by real compiler classes.  The class also has  some utility methods
used by several compiler classes.</p>
<p>The basic idea behind a compiler abstraction class is that each instance can be
used for all the compile/link steps in building a single project.  Thus,
attributes common to all of those compile and link steps — include
directories, macros to define, libraries to link against, etc. — are
attributes of the compiler instance.  To allow for variability in how individual
files are treated, most of those attributes may be varied on a per-compilation
or per-link basis.</p>
<p>The constructor for each subclass creates an instance of the Compiler object.
Flags are <em>verbose</em> (show verbose output), <em>dry_run</em> (don’t actually execute the
steps) and <em>force</em> (rebuild everything, regardless of dependencies). All of
these flags default to <code class="docutils literal"><span class="pre">0</span></code> (off). Note that you probably don’t want to
instantiate <a class="reference internal" href="#distutils.ccompiler.CCompiler" title="distutils.ccompiler.CCompiler"><code class="xref py py-class docutils literal"><span class="pre">CCompiler</span></code></a> or one of its subclasses directly - use the
<code class="xref py py-func docutils literal"><span class="pre">distutils.CCompiler.new_compiler()</span></code> factory function instead.</p>
<p>The following methods allow you to manually alter compiler options for  the
instance of the Compiler class.</p>
<dl class="method">
<dt id="distutils.ccompiler.CCompiler.add_include_dir">
<code class="descname">add_include_dir</code><span class="sig-paren">(</span><em>dir</em><span class="sig-paren">)</span><a class="headerlink" href="#distutils.ccompiler.CCompiler.add_include_dir" title="Permalink to this definition">¶</a></dt>
<dd><p>Add <em>dir</em> to the list of directories that will be searched for header files.
The compiler is instructed to search directories in the order in which they are
supplied by successive calls to <a class="reference internal" href="#distutils.ccompiler.CCompiler.add_include_dir" title="distutils.ccompiler.CCompiler.add_include_dir"><code class="xref py py-meth docutils literal"><span class="pre">add_include_dir()</span></code></a>.</p>
</dd></dl>

<dl class="method">
<dt id="distutils.ccompiler.CCompiler.set_include_dirs">
<code class="descname">set_include_dirs</code><span class="sig-paren">(</span><em>dirs</em><span class="sig-paren">)</span><a class="headerlink" href="#distutils.ccompiler.CCompiler.set_include_dirs" title="Permalink to this definition">¶</a></dt>
<dd><p>Set the list of directories that will be searched to <em>dirs</em> (a list of strings).
Overrides any preceding calls to <a class="reference internal" href="#distutils.ccompiler.CCompiler.add_include_dir" title="distutils.ccompiler.CCompiler.add_include_dir"><code class="xref py py-meth docutils literal"><span class="pre">add_include_dir()</span></code></a>; subsequent calls to
<a class="reference internal" href="#distutils.ccompiler.CCompiler.add_include_dir" title="distutils.ccompiler.CCompiler.add_include_dir"><code class="xref py py-meth docutils literal"><span class="pre">add_include_dir()</span></code></a> add to the list passed to <a class="reference internal" href="#distutils.ccompiler.CCompiler.set_include_dirs" title="distutils.ccompiler.CCompiler.set_include_dirs"><code class="xref py py-meth docutils literal"><span class="pre">set_include_dirs()</span></code></a>.
This does not affect any list of standard include directories that the compiler
may search by default.</p>
</dd></dl>

<dl class="method">
<dt id="distutils.ccompiler.CCompiler.add_library">
<code class="descname">add_library</code><span class="sig-paren">(</span><em>libname</em><span class="sig-paren">)</span><a class="headerlink" href="#distutils.ccompiler.CCompiler.add_library" title="Permalink to this definition">¶</a></dt>
<dd><p>Add <em>libname</em> to the list of libraries that will be included in all links driven
by this compiler object.  Note that <em>libname</em> should *not* be the name of a
file containing a library, but the name of the library itself: the actual
filename will be inferred by the linker, the compiler, or the compiler class
(depending on the platform).</p>
<p>The linker will be instructed to link against libraries in the order they were
supplied to <a class="reference internal" href="#distutils.ccompiler.CCompiler.add_library" title="distutils.ccompiler.CCompiler.add_library"><code class="xref py py-meth docutils literal"><span class="pre">add_library()</span></code></a> and/or <a class="reference internal" href="#distutils.ccompiler.CCompiler.set_libraries" title="distutils.ccompiler.CCompiler.set_libraries"><code class="xref py py-meth docutils literal"><span class="pre">set_libraries()</span></code></a>.  It is perfectly
valid to duplicate library names; the linker will be instructed to link against
libraries as many times as they are mentioned.</p>
</dd></dl>

<dl class="method">
<dt id="distutils.ccompiler.CCompiler.set_libraries">
<code class="descname">set_libraries</code><span class="sig-paren">(</span><em>libnames</em><span class="sig-paren">)</span><a class="headerlink" href="#distutils.ccompiler.CCompiler.set_libraries" title="Permalink to this definition">¶</a></dt>
<dd><p>Set the list of libraries to be included in all links driven by this compiler
object to <em>libnames</em> (a list of strings).  This does not affect any standard
system libraries that the linker may include by default.</p>
</dd></dl>

<dl class="method">
<dt id="distutils.ccompiler.CCompiler.add_library_dir">
<code class="descname">add_library_dir</code><span class="sig-paren">(</span><em>dir</em><span class="sig-paren">)</span><a class="headerlink" href="#distutils.ccompiler.CCompiler.add_library_dir" title="Permalink to this definition">¶</a></dt>
<dd><p>Add <em>dir</em> to the list of directories that will be searched for libraries
specified to <a class="reference internal" href="#distutils.ccompiler.CCompiler.add_library" title="distutils.ccompiler.CCompiler.add_library"><code class="xref py py-meth docutils literal"><span class="pre">add_library()</span></code></a> and <a class="reference internal" href="#distutils.ccompiler.CCompiler.set_libraries" title="distutils.ccompiler.CCompiler.set_libraries"><code class="xref py py-meth docutils literal"><span class="pre">set_libraries()</span></code></a>.  The linker will be
instructed to search for libraries in the order they are supplied to
<a class="reference internal" href="#distutils.ccompiler.CCompiler.add_library_dir" title="distutils.ccompiler.CCompiler.add_library_dir"><code class="xref py py-meth docutils literal"><span class="pre">add_library_dir()</span></code></a> and/or <a class="reference internal" href="#distutils.ccompiler.CCompiler.set_library_dirs" title="distutils.ccompiler.CCompiler.set_library_dirs"><code class="xref py py-meth docutils literal"><span class="pre">set_library_dirs()</span></code></a>.</p>
</dd></dl>

<dl class="method">
<dt id="distutils.ccompiler.CCompiler.set_library_dirs">
<code class="descname">set_library_dirs</code><span class="sig-paren">(</span><em>dirs</em><span class="sig-paren">)</span><a class="headerlink" href="#distutils.ccompiler.CCompiler.set_library_dirs" title="Permalink to this definition">¶</a></dt>
<dd><p>Set the list of library search directories to <em>dirs</em> (a list of strings).  This
does not affect any standard library search path that the linker may search by
default.</p>
</dd></dl>

<dl class="method">
<dt id="distutils.ccompiler.CCompiler.add_runtime_library_dir">
<code class="descname">add_runtime_library_dir</code><span class="sig-paren">(</span><em>dir</em><span class="sig-paren">)</span><a class="headerlink" href="#distutils.ccompiler.CCompiler.add_runtime_library_dir" title="Permalink to this definition">¶</a></dt>
<dd><p>Add <em>dir</em> to the list of directories that will be searched for shared libraries
at runtime.</p>
</dd></dl>

<dl class="method">
<dt id="distutils.ccompiler.CCompiler.set_runtime_library_dirs">
<code class="descname">set_runtime_library_dirs</code><span class="sig-paren">(</span><em>dirs</em><span class="sig-paren">)</span><a class="headerlink" href="#distutils.ccompiler.CCompiler.set_runtime_library_dirs" title="Permalink to this definition">¶</a></dt>
<dd><p>Set the list of directories to search for shared libraries at runtime to <em>dirs</em>
(a list of strings).  This does not affect any standard search path that the
runtime linker may search by default.</p>
</dd></dl>

<dl class="method">
<dt id="distutils.ccompiler.CCompiler.define_macro">
<code class="descname">define_macro</code><span class="sig-paren">(</span><em>name</em><span class="optional">[</span>, <em>value=None</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#distutils.ccompiler.CCompiler.define_macro" title="Permalink to this definition">¶</a></dt>
<dd><p>Define a preprocessor macro for all compilations driven by this compiler object.
The optional parameter <em>value</em> should be a string; if it is not supplied, then
the macro will be defined without an explicit value and the exact outcome
depends on the compiler used.</p>
</dd></dl>

<dl class="method">
<dt id="distutils.ccompiler.CCompiler.undefine_macro">
<code class="descname">undefine_macro</code><span class="sig-paren">(</span><em>name</em><span class="sig-paren">)</span><a class="headerlink" href="#distutils.ccompiler.CCompiler.undefine_macro" title="Permalink to this definition">¶</a></dt>
<dd><p>Undefine a preprocessor macro for all compilations driven by this compiler
object.  If the same macro is defined by <a class="reference internal" href="#distutils.ccompiler.CCompiler.define_macro" title="distutils.ccompiler.CCompiler.define_macro"><code class="xref py py-meth docutils literal"><span class="pre">define_macro()</span></code></a> and
undefined by <a class="reference internal" href="#distutils.ccompiler.CCompiler.undefine_macro" title="distutils.ccompiler.CCompiler.undefine_macro"><code class="xref py py-meth docutils literal"><span class="pre">undefine_macro()</span></code></a> the last call takes precedence
(including multiple redefinitions or undefinitions).  If the macro is
redefined/undefined on a per-compilation basis (ie. in the call to
<a class="reference internal" href="../library/functions.html#compile" title="compile"><code class="xref py py-meth docutils literal"><span class="pre">compile()</span></code></a>), then that takes precedence.</p>
</dd></dl>

<dl class="method">
<dt id="distutils.ccompiler.CCompiler.add_link_object">
<code class="descname">add_link_object</code><span class="sig-paren">(</span><em>object</em><span class="sig-paren">)</span><a class="headerlink" href="#distutils.ccompiler.CCompiler.add_link_object" title="Permalink to this definition">¶</a></dt>
<dd><p>Add <em>object</em> to the list of object files (or analogues, such as explicitly named
library files or the output of “resource compilers”) to be included in every
link driven by this compiler object.</p>
</dd></dl>

<dl class="method">
<dt id="distutils.ccompiler.CCompiler.set_link_objects">
<code class="descname">set_link_objects</code><span class="sig-paren">(</span><em>objects</em><span class="sig-paren">)</span><a class="headerlink" href="#distutils.ccompiler.CCompiler.set_link_objects" title="Permalink to this definition">¶</a></dt>
<dd><p>Set the list of object files (or analogues) to be included in every link to
<em>objects</em>.  This does not affect any standard object files that the linker may
include by default (such as system libraries).</p>
</dd></dl>

<p>The following methods implement methods for autodetection of compiler  options,
providing some functionality similar to GNU <strong class="program">autoconf</strong>.</p>
<dl class="method">
<dt id="distutils.ccompiler.CCompiler.detect_language">
<code class="descname">detect_language</code><span class="sig-paren">(</span><em>sources</em><span class="sig-paren">)</span><a class="headerlink" href="#distutils.ccompiler.CCompiler.detect_language" title="Permalink to this definition">¶</a></dt>
<dd><p>Detect the language of a given file, or list of files. Uses the  instance
attributes <code class="xref py py-attr docutils literal"><span class="pre">language_map</span></code> (a dictionary), and  <code class="xref py py-attr docutils literal"><span class="pre">language_order</span></code> (a
list) to do the job.</p>
</dd></dl>

<dl class="method">
<dt id="distutils.ccompiler.CCompiler.find_library_file">
<code class="descname">find_library_file</code><span class="sig-paren">(</span><em>dirs</em>, <em>lib</em><span class="optional">[</span>, <em>debug=0</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#distutils.ccompiler.CCompiler.find_library_file" title="Permalink to this definition">¶</a></dt>
<dd><p>Search the specified list of directories for a static or shared library file
<em>lib</em> and return the full path to that file.  If <em>debug</em> is true, look for a
debugging version (if that makes sense on the current platform).  Return
<code class="docutils literal"><span class="pre">None</span></code> if <em>lib</em> wasn’t found in any of the specified directories.</p>
</dd></dl>

<dl class="method">
<dt id="distutils.ccompiler.CCompiler.has_function">
<code class="descname">has_function</code><span class="sig-paren">(</span><em>funcname</em><span class="optional">[</span>, <em>includes=None</em>, <em>include_dirs=None</em>, <em>libraries=None</em>, <em>library_dirs=None</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#distutils.ccompiler.CCompiler.has_function" title="Permalink to this definition">¶</a></dt>
<dd><p>Return a boolean indicating whether <em>funcname</em> is supported on the current
platform.  The optional arguments can be used to augment the compilation
environment by providing additional include files and paths and libraries and
paths.</p>
</dd></dl>

<dl class="method">
<dt id="distutils.ccompiler.CCompiler.library_dir_option">
<code class="descname">library_dir_option</code><span class="sig-paren">(</span><em>dir</em><span class="sig-paren">)</span><a class="headerlink" href="#distutils.ccompiler.CCompiler.library_dir_option" title="Permalink to this definition">¶</a></dt>
<dd><p>Return the compiler option to add <em>dir</em> to the list of directories searched for
libraries.</p>
</dd></dl>

<dl class="method">
<dt id="distutils.ccompiler.CCompiler.library_option">
<code class="descname">library_option</code><span class="sig-paren">(</span><em>lib</em><span class="sig-paren">)</span><a class="headerlink" href="#distutils.ccompiler.CCompiler.library_option" title="Permalink to this definition">¶</a></dt>
<dd><p>Return the compiler option to add <em>lib</em> to the list of libraries linked into the
shared library or executable.</p>
</dd></dl>

<dl class="method">
<dt id="distutils.ccompiler.CCompiler.runtime_library_dir_option">
<code class="descname">runtime_library_dir_option</code><span class="sig-paren">(</span><em>dir</em><span class="sig-paren">)</span><a class="headerlink" href="#distutils.ccompiler.CCompiler.runtime_library_dir_option" title="Permalink to this definition">¶</a></dt>
<dd><p>Return the compiler option to add <em>dir</em> to the list of directories searched for
runtime libraries.</p>
</dd></dl>

<dl class="method">
<dt id="distutils.ccompiler.CCompiler.set_executables">
<code class="descname">set_executables</code><span class="sig-paren">(</span><em>**args</em><span class="sig-paren">)</span><a class="headerlink" href="#distutils.ccompiler.CCompiler.set_executables" title="Permalink to this definition">¶</a></dt>
<dd><p>Define the executables (and options for them) that will be run to perform the
various stages of compilation.  The exact set of executables that may be
specified here depends on the compiler class (via the ‘executables’ class
attribute), but most will have:</p>
<table border="1" class="docutils">
<colgroup>
<col width="25%" />
<col width="75%" />
</colgroup>
<thead valign="bottom">
<tr class="row-odd"><th class="head">attribute</th>
<th class="head">description</th>
</tr>
</thead>
<tbody valign="top">
<tr class="row-even"><td><em>compiler</em></td>
<td>the C/C++ compiler</td>
</tr>
<tr class="row-odd"><td><em>linker_so</em></td>
<td>linker used to create shared objects and
libraries</td>
</tr>
<tr class="row-even"><td><em>linker_exe</em></td>
<td>linker used to create binary executables</td>
</tr>
<tr class="row-odd"><td><em>archiver</em></td>
<td>static library creator</td>
</tr>
</tbody>
</table>
<p>On platforms with a command-line (Unix, DOS/Windows), each of these is a string
that will be split into executable name and (optional) list of arguments.
(Splitting the string is done similarly to how Unix shells operate: words are
delimited by spaces, but quotes and backslashes can override this.  See
<a class="reference internal" href="#distutils.util.split_quoted" title="distutils.util.split_quoted"><code class="xref py py-func docutils literal"><span class="pre">distutils.util.split_quoted()</span></code></a>.)</p>
</dd></dl>

<p>The following methods invoke stages in the build process.</p>
<dl class="method">
<dt id="distutils.ccompiler.CCompiler.compile">
<code class="descname">compile</code><span class="sig-paren">(</span><em>sources</em><span class="optional">[</span>, <em>output_dir=None</em>, <em>macros=None</em>, <em>include_dirs=None</em>, <em>debug=0</em>, <em>extra_preargs=None</em>, <em>extra_postargs=None</em>, <em>depends=None</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#distutils.ccompiler.CCompiler.compile" title="Permalink to this definition">¶</a></dt>
<dd><p>Compile one or more source files. Generates object files (e.g.  transforms a
<code class="file docutils literal"><span class="pre">.c</span></code> file to a <code class="file docutils literal"><span class="pre">.o</span></code> file.)</p>
<p><em>sources</em> must be a list of filenames, most likely C/C++ files, but in reality
anything that can be handled by a particular compiler and compiler class (eg.
<code class="xref py py-class docutils literal"><span class="pre">MSVCCompiler</span></code> can handle resource files in <em>sources</em>).  Return a list of
object filenames, one per source filename in <em>sources</em>.  Depending on the
implementation, not all source files will necessarily be compiled, but all
corresponding object filenames will be returned.</p>
<p>If <em>output_dir</em> is given, object files will be put under it, while retaining
their original path component.  That is, <code class="file docutils literal"><span class="pre">foo/bar.c</span></code> normally compiles to
<code class="file docutils literal"><span class="pre">foo/bar.o</span></code> (for a Unix implementation); if <em>output_dir</em> is <em>build</em>, then
it would compile to <code class="file docutils literal"><span class="pre">build/foo/bar.o</span></code>.</p>
<p><em>macros</em>, if given, must be a list of macro definitions.  A macro definition is
either a <code class="docutils literal"><span class="pre">(name,</span> <span class="pre">value)</span></code> 2-tuple or a <code class="docutils literal"><span class="pre">(name,)</span></code> 1-tuple. The former defines
a macro; if the value is <code class="docutils literal"><span class="pre">None</span></code>, the macro is defined without an explicit
value.  The 1-tuple case undefines a macro.  Later
definitions/redefinitions/undefinitions take precedence.</p>
<p><em>include_dirs</em>, if given, must be a list of strings, the directories to add to
the default include file search path for this compilation only.</p>
<p><em>debug</em> is a boolean; if true, the compiler will be instructed to output debug
symbols in (or alongside) the object file(s).</p>
<p><em>extra_preargs</em> and <em>extra_postargs</em> are implementation-dependent. On platforms
that have the notion of a command-line (e.g. Unix, DOS/Windows), they are most
likely lists of strings: extra command-line arguments to prepend/append to the
compiler command line.  On other platforms, consult the implementation class
documentation.  In any event, they are intended as an escape hatch for those
occasions when the abstract compiler framework doesn’t cut the mustard.</p>
<p><em>depends</em>, if given, is a list of filenames that all targets depend on.  If a
source file is older than any file in depends, then the source file will be
recompiled.  This supports dependency tracking, but only at a coarse
granularity.</p>
<p>Raises <code class="xref py py-exc docutils literal"><span class="pre">CompileError</span></code> on failure.</p>
</dd></dl>

<dl class="method">
<dt id="distutils.ccompiler.CCompiler.create_static_lib">
<code class="descname">create_static_lib</code><span class="sig-paren">(</span><em>objects</em>, <em>output_libname</em><span class="optional">[</span>, <em>output_dir=None</em>, <em>debug=0</em>, <em>target_lang=None</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#distutils.ccompiler.CCompiler.create_static_lib" title="Permalink to this definition">¶</a></dt>
<dd><p>Link a bunch of stuff together to create a static library file. The “bunch of
stuff” consists of the list of object files supplied as <em>objects</em>, the extra
object files supplied to <a class="reference internal" href="#distutils.ccompiler.CCompiler.add_link_object" title="distutils.ccompiler.CCompiler.add_link_object"><code class="xref py py-meth docutils literal"><span class="pre">add_link_object()</span></code></a> and/or
<a class="reference internal" href="#distutils.ccompiler.CCompiler.set_link_objects" title="distutils.ccompiler.CCompiler.set_link_objects"><code class="xref py py-meth docutils literal"><span class="pre">set_link_objects()</span></code></a>, the libraries supplied to <a class="reference internal" href="#distutils.ccompiler.CCompiler.add_library" title="distutils.ccompiler.CCompiler.add_library"><code class="xref py py-meth docutils literal"><span class="pre">add_library()</span></code></a> and/or
<a class="reference internal" href="#distutils.ccompiler.CCompiler.set_libraries" title="distutils.ccompiler.CCompiler.set_libraries"><code class="xref py py-meth docutils literal"><span class="pre">set_libraries()</span></code></a>, and the libraries supplied as <em>libraries</em> (if any).</p>
<p><em>output_libname</em> should be a library name, not a filename; the filename will be
inferred from the library name.  <em>output_dir</em> is the directory where the library
file will be put.</p>
<p><em>debug</em> is a boolean; if true, debugging information will be included in the
library (note that on most platforms, it is the compile step where this matters:
the <em>debug</em> flag is included here just for consistency).</p>
<p><em>target_lang</em> is the target language for which the given objects are being
compiled. This allows specific linkage time treatment of certain languages.</p>
<p>Raises <code class="xref py py-exc docutils literal"><span class="pre">LibError</span></code> on failure.</p>
</dd></dl>

<dl class="method">
<dt id="distutils.ccompiler.CCompiler.link">
<code class="descname">link</code><span class="sig-paren">(</span><em>target_desc</em>, <em>objects</em>, <em>output_filename</em><span class="optional">[</span>, <em>output_dir=None</em>, <em>libraries=None</em>, <em>library_dirs=None</em>, <em>runtime_library_dirs=None</em>, <em>export_symbols=None</em>, <em>debug=0</em>, <em>extra_preargs=None</em>, <em>extra_postargs=None</em>, <em>build_temp=None</em>, <em>target_lang=None</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#distutils.ccompiler.CCompiler.link" title="Permalink to this definition">¶</a></dt>
<dd><p>Link a bunch of stuff together to create an executable or shared library file.</p>
<p>The “bunch of stuff” consists of the list of object files supplied as <em>objects</em>.
<em>output_filename</em> should be a filename.  If <em>output_dir</em> is supplied,
<em>output_filename</em> is relative to it (i.e. <em>output_filename</em> can provide
directory components if needed).</p>
<p><em>libraries</em> is a list of libraries to link against.  These are library names,
not filenames, since they’re translated into filenames in a platform-specific
way (eg. <em>foo</em> becomes <code class="file docutils literal"><span class="pre">libfoo.a</span></code> on Unix and <code class="file docutils literal"><span class="pre">foo.lib</span></code> on
DOS/Windows).  However, they can include a directory component, which means the
linker will look in that specific directory rather than searching all the normal
locations.</p>
<p><em>library_dirs</em>, if supplied, should be a list of directories to search for
libraries that were specified as bare library names (ie. no directory
component).  These are on top of the system default and those supplied to
<a class="reference internal" href="#distutils.ccompiler.CCompiler.add_library_dir" title="distutils.ccompiler.CCompiler.add_library_dir"><code class="xref py py-meth docutils literal"><span class="pre">add_library_dir()</span></code></a> and/or <a class="reference internal" href="#distutils.ccompiler.CCompiler.set_library_dirs" title="distutils.ccompiler.CCompiler.set_library_dirs"><code class="xref py py-meth docutils literal"><span class="pre">set_library_dirs()</span></code></a>.  <em>runtime_library_dirs</em>
is a list of directories that will be embedded into the shared library and used
to search for other shared libraries that *it* depends on at run-time.  (This
may only be relevant on Unix.)</p>
<p><em>export_symbols</em> is a list of symbols that the shared library will export.
(This appears to be relevant only on Windows.)</p>
<p><em>debug</em> is as for <a class="reference internal" href="../library/functions.html#compile" title="compile"><code class="xref py py-meth docutils literal"><span class="pre">compile()</span></code></a> and <a class="reference internal" href="#distutils.ccompiler.CCompiler.create_static_lib" title="distutils.ccompiler.CCompiler.create_static_lib"><code class="xref py py-meth docutils literal"><span class="pre">create_static_lib()</span></code></a>,  with the
slight distinction that it actually matters on most platforms (as opposed to
<a class="reference internal" href="#distutils.ccompiler.CCompiler.create_static_lib" title="distutils.ccompiler.CCompiler.create_static_lib"><code class="xref py py-meth docutils literal"><span class="pre">create_static_lib()</span></code></a>, which includes a <em>debug</em> flag mostly for form’s
sake).</p>
<p><em>extra_preargs</em> and <em>extra_postargs</em> are as for <a class="reference internal" href="../library/functions.html#compile" title="compile"><code class="xref py py-meth docutils literal"><span class="pre">compile()</span></code></a>  (except of
course that they supply command-line arguments for the particular linker being
used).</p>
<p><em>target_lang</em> is the target language for which the given objects are being
compiled. This allows specific linkage time treatment of certain languages.</p>
<p>Raises <code class="xref py py-exc docutils literal"><span class="pre">LinkError</span></code> on failure.</p>
</dd></dl>

<dl class="method">
<dt id="distutils.ccompiler.CCompiler.link_executable">
<code class="descname">link_executable</code><span class="sig-paren">(</span><em>objects</em>, <em>output_progname</em><span class="optional">[</span>, <em>output_dir=None</em>, <em>libraries=None</em>, <em>library_dirs=None</em>, <em>runtime_library_dirs=None</em>, <em>debug=0</em>, <em>extra_preargs=None</em>, <em>extra_postargs=None</em>, <em>target_lang=None</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#distutils.ccompiler.CCompiler.link_executable" title="Permalink to this definition">¶</a></dt>
<dd><p>Link an executable.  <em>output_progname</em> is the name of the file executable, while
<em>objects</em> are a list of object filenames to link in. Other arguments  are as for
the <a class="reference internal" href="#distutils.ccompiler.CCompiler.link" title="distutils.ccompiler.CCompiler.link"><code class="xref py py-meth docutils literal"><span class="pre">link()</span></code></a> method.</p>
</dd></dl>

<dl class="method">
<dt id="distutils.ccompiler.CCompiler.link_shared_lib">
<code class="descname">link_shared_lib</code><span class="sig-paren">(</span><em>objects</em>, <em>output_libname</em><span class="optional">[</span>, <em>output_dir=None</em>, <em>libraries=None</em>, <em>library_dirs=None</em>, <em>runtime_library_dirs=None</em>, <em>export_symbols=None</em>, <em>debug=0</em>, <em>extra_preargs=None</em>, <em>extra_postargs=None</em>, <em>build_temp=None</em>, <em>target_lang=None</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#distutils.ccompiler.CCompiler.link_shared_lib" title="Permalink to this definition">¶</a></dt>
<dd><p>Link a shared library. <em>output_libname</em> is the name of the output  library,
while <em>objects</em> is a list of object filenames to link in.  Other arguments are
as for the <a class="reference internal" href="#distutils.ccompiler.CCompiler.link" title="distutils.ccompiler.CCompiler.link"><code class="xref py py-meth docutils literal"><span class="pre">link()</span></code></a> method.</p>
</dd></dl>

<dl class="method">
<dt id="distutils.ccompiler.CCompiler.link_shared_object">
<code class="descname">link_shared_object</code><span class="sig-paren">(</span><em>objects</em>, <em>output_filename</em><span class="optional">[</span>, <em>output_dir=None</em>, <em>libraries=None</em>, <em>library_dirs=None</em>, <em>runtime_library_dirs=None</em>, <em>export_symbols=None</em>, <em>debug=0</em>, <em>extra_preargs=None</em>, <em>extra_postargs=None</em>, <em>build_temp=None</em>, <em>target_lang=None</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#distutils.ccompiler.CCompiler.link_shared_object" title="Permalink to this definition">¶</a></dt>
<dd><p>Link a shared object. <em>output_filename</em> is the name of the shared object that
will be created, while <em>objects</em> is a list of object filenames  to link in.
Other arguments are as for the <a class="reference internal" href="#distutils.ccompiler.CCompiler.link" title="distutils.ccompiler.CCompiler.link"><code class="xref py py-meth docutils literal"><span class="pre">link()</span></code></a> method.</p>
</dd></dl>

<dl class="method">
<dt id="distutils.ccompiler.CCompiler.preprocess">
<code class="descname">preprocess</code><span class="sig-paren">(</span><em>source</em><span class="optional">[</span>, <em>output_file=None</em>, <em>macros=None</em>, <em>include_dirs=None</em>, <em>extra_preargs=None</em>, <em>extra_postargs=None</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#distutils.ccompiler.CCompiler.preprocess" title="Permalink to this definition">¶</a></dt>
<dd><p>Preprocess a single C/C++ source file, named in <em>source</em>. Output will be written
to file named <em>output_file</em>, or <em>stdout</em> if <em>output_file</em> not supplied.
<em>macros</em> is a list of macro definitions as for <a class="reference internal" href="../library/functions.html#compile" title="compile"><code class="xref py py-meth docutils literal"><span class="pre">compile()</span></code></a>, which will
augment the macros set with <a class="reference internal" href="#distutils.ccompiler.CCompiler.define_macro" title="distutils.ccompiler.CCompiler.define_macro"><code class="xref py py-meth docutils literal"><span class="pre">define_macro()</span></code></a> and <a class="reference internal" href="#distutils.ccompiler.CCompiler.undefine_macro" title="distutils.ccompiler.CCompiler.undefine_macro"><code class="xref py py-meth docutils literal"><span class="pre">undefine_macro()</span></code></a>.
<em>include_dirs</em> is a list of directory names that will be added to the  default
list, in the same way as <a class="reference internal" href="#distutils.ccompiler.CCompiler.add_include_dir" title="distutils.ccompiler.CCompiler.add_include_dir"><code class="xref py py-meth docutils literal"><span class="pre">add_include_dir()</span></code></a>.</p>
<p>Raises <code class="xref py py-exc docutils literal"><span class="pre">PreprocessError</span></code> on failure.</p>
</dd></dl>

<p>The following utility methods are defined by the <a class="reference internal" href="#distutils.ccompiler.CCompiler" title="distutils.ccompiler.CCompiler"><code class="xref py py-class docutils literal"><span class="pre">CCompiler</span></code></a> class, for
use by the various concrete subclasses.</p>
<dl class="method">
<dt id="distutils.ccompiler.CCompiler.executable_filename">
<code class="descname">executable_filename</code><span class="sig-paren">(</span><em>basename</em><span class="optional">[</span>, <em>strip_dir=0</em>, <em>output_dir=''</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#distutils.ccompiler.CCompiler.executable_filename" title="Permalink to this definition">¶</a></dt>
<dd><p>Returns the filename of the executable for the given <em>basename</em>.  Typically for
non-Windows platforms this is the same as the basename,  while Windows will get
a <code class="file docutils literal"><span class="pre">.exe</span></code> added.</p>
</dd></dl>

<dl class="method">
<dt id="distutils.ccompiler.CCompiler.library_filename">
<code class="descname">library_filename</code><span class="sig-paren">(</span><em>libname</em><span class="optional">[</span>, <em>lib_type='static'</em>, <em>strip_dir=0</em>, <em>output_dir=''</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#distutils.ccompiler.CCompiler.library_filename" title="Permalink to this definition">¶</a></dt>
<dd><p>Returns the filename for the given library name on the current platform. On Unix
a library with <em>lib_type</em> of <code class="docutils literal"><span class="pre">'static'</span></code> will typically  be of the form
<code class="file docutils literal"><span class="pre">liblibname.a</span></code>, while a <em>lib_type</em> of <code class="docutils literal"><span class="pre">'dynamic'</span></code>  will be of the form
<code class="file docutils literal"><span class="pre">liblibname.so</span></code>.</p>
</dd></dl>

<dl class="method">
<dt id="distutils.ccompiler.CCompiler.object_filenames">
<code class="descname">object_filenames</code><span class="sig-paren">(</span><em>source_filenames</em><span class="optional">[</span>, <em>strip_dir=0</em>, <em>output_dir=''</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#distutils.ccompiler.CCompiler.object_filenames" title="Permalink to this definition">¶</a></dt>
<dd><p>Returns the name of the object files for the given source files.
<em>source_filenames</em> should be a list of filenames.</p>
</dd></dl>

<dl class="method">
<dt id="distutils.ccompiler.CCompiler.shared_object_filename">
<code class="descname">shared_object_filename</code><span class="sig-paren">(</span><em>basename</em><span class="optional">[</span>, <em>strip_dir=0</em>, <em>output_dir=''</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#distutils.ccompiler.CCompiler.shared_object_filename" title="Permalink to this definition">¶</a></dt>
<dd><p>Returns the name of a shared object file for the given file name <em>basename</em>.</p>
</dd></dl>

<dl class="method">
<dt id="distutils.ccompiler.CCompiler.execute">
<code class="descname">execute</code><span class="sig-paren">(</span><em>func</em>, <em>args</em><span class="optional">[</span>, <em>msg=None</em>, <em>level=1</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#distutils.ccompiler.CCompiler.execute" title="Permalink to this definition">¶</a></dt>
<dd><p>Invokes <a class="reference internal" href="#distutils.util.execute" title="distutils.util.execute"><code class="xref py py-func docutils literal"><span class="pre">distutils.util.execute()</span></code></a>. This method invokes a  Python function
<em>func</em> with the given arguments <em>args</em>, after  logging and taking into account
the <em>dry_run</em> flag.</p>
</dd></dl>

<dl class="method">
<dt id="distutils.ccompiler.CCompiler.spawn">
<code class="descname">spawn</code><span class="sig-paren">(</span><em>cmd</em><span class="sig-paren">)</span><a class="headerlink" href="#distutils.ccompiler.CCompiler.spawn" title="Permalink to this definition">¶</a></dt>
<dd><p>Invokes <code class="xref py py-func docutils literal"><span class="pre">distutils.util.spawn()</span></code>. This invokes an external  process to run
the given command.</p>
</dd></dl>

<dl class="method">
<dt id="distutils.ccompiler.CCompiler.mkpath">
<code class="descname">mkpath</code><span class="sig-paren">(</span><em>name</em><span class="optional">[</span>, <em>mode=511</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#distutils.ccompiler.CCompiler.mkpath" title="Permalink to this definition">¶</a></dt>
<dd><p>Invokes <a class="reference internal" href="#distutils.dir_util.mkpath" title="distutils.dir_util.mkpath"><code class="xref py py-func docutils literal"><span class="pre">distutils.dir_util.mkpath()</span></code></a>. This creates a directory  and any
missing ancestor directories.</p>
</dd></dl>

<dl class="method">
<dt id="distutils.ccompiler.CCompiler.move_file">
<code class="descname">move_file</code><span class="sig-paren">(</span><em>src</em>, <em>dst</em><span class="sig-paren">)</span><a class="headerlink" href="#distutils.ccompiler.CCompiler.move_file" title="Permalink to this definition">¶</a></dt>
<dd><p>Invokes <a class="reference internal" href="#distutils.file_util.move_file" title="distutils.file_util.move_file"><code class="xref py py-meth docutils literal"><span class="pre">distutils.file_util.move_file()</span></code></a>. Renames <em>src</em> to  <em>dst</em>.</p>
</dd></dl>

<dl class="method">
<dt id="distutils.ccompiler.CCompiler.announce">
<code class="descname">announce</code><span class="sig-paren">(</span><em>msg</em><span class="optional">[</span>, <em>level=1</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#distutils.ccompiler.CCompiler.announce" title="Permalink to this definition">¶</a></dt>
<dd><p>Write a message using <code class="xref py py-func docutils literal"><span class="pre">distutils.log.debug()</span></code>.</p>
</dd></dl>

<dl class="method">
<dt id="distutils.ccompiler.CCompiler.warn">
<code class="descname">warn</code><span class="sig-paren">(</span><em>msg</em><span class="sig-paren">)</span><a class="headerlink" href="#distutils.ccompiler.CCompiler.warn" title="Permalink to this definition">¶</a></dt>
<dd><p>Write a warning message <em>msg</em> to standard error.</p>
</dd></dl>

<dl class="method">
<dt id="distutils.ccompiler.CCompiler.debug_print">
<code class="descname">debug_print</code><span class="sig-paren">(</span><em>msg</em><span class="sig-paren">)</span><a class="headerlink" href="#distutils.ccompiler.CCompiler.debug_print" title="Permalink to this definition">¶</a></dt>
<dd><p>If the <em>debug</em> flag is set on this <a class="reference internal" href="#distutils.ccompiler.CCompiler" title="distutils.ccompiler.CCompiler"><code class="xref py py-class docutils literal"><span class="pre">CCompiler</span></code></a> instance, print  <em>msg</em> to
standard output, otherwise do nothing.</p>
</dd></dl>

</dd></dl>

</div>
<div class="section" id="module-distutils.unixccompiler">
<span id="distutils-unixccompiler-unix-c-compiler"></span><h2>10.3. <a class="reference internal" href="#module-distutils.unixccompiler" title="distutils.unixccompiler: UNIX C Compiler"><code class="xref py py-mod docutils literal"><span class="pre">distutils.unixccompiler</span></code></a> — Unix C Compiler<a class="headerlink" href="#module-distutils.unixccompiler" title="Permalink to this headline">¶</a></h2>
<p>This module provides the <code class="xref py py-class docutils literal"><span class="pre">UnixCCompiler</span></code> class, a subclass of
<code class="xref py py-class docutils literal"><span class="pre">CCompiler</span></code> that handles the typical Unix-style command-line  C compiler:</p>
<ul class="simple">
<li>macros defined with <code class="xref std std-option docutils literal"><span class="pre">-Dname[=value]</span></code></li>
<li>macros undefined with <code class="xref std std-option docutils literal"><span class="pre">-Uname</span></code></li>
<li>include search directories specified with <code class="xref std std-option docutils literal"><span class="pre">-Idir</span></code></li>
<li>libraries specified with <code class="xref std std-option docutils literal"><span class="pre">-llib</span></code></li>
<li>library search directories specified with <code class="xref std std-option docutils literal"><span class="pre">-Ldir</span></code></li>
<li>compile handled by <strong class="program">cc</strong> (or similar) executable with <code class="xref std std-option docutils literal"><span class="pre">-c</span></code>
option: compiles <code class="file docutils literal"><span class="pre">.c</span></code> to <code class="file docutils literal"><span class="pre">.o</span></code></li>
<li>link static library handled by <strong class="program">ar</strong> command (possibly with
<strong class="program">ranlib</strong>)</li>
<li>link shared library handled by <strong class="program">cc</strong> <code class="xref std std-option docutils literal"><span class="pre">-shared</span></code></li>
</ul>
</div>
<div class="section" id="module-distutils.msvccompiler">
<span id="distutils-msvccompiler-microsoft-compiler"></span><h2>10.4. <a class="reference internal" href="#module-distutils.msvccompiler" title="distutils.msvccompiler: Microsoft Compiler"><code class="xref py py-mod docutils literal"><span class="pre">distutils.msvccompiler</span></code></a> — Microsoft Compiler<a class="headerlink" href="#module-distutils.msvccompiler" title="Permalink to this headline">¶</a></h2>
<p>This module provides <code class="xref py py-class docutils literal"><span class="pre">MSVCCompiler</span></code>, an implementation of the abstract
<code class="xref py py-class docutils literal"><span class="pre">CCompiler</span></code> class for Microsoft Visual Studio. Typically, extension
modules need to be compiled with the same compiler that was used to compile
Python. For Python 2.3 and earlier, the compiler was Visual Studio 6. For Python
2.4 and 2.5, the compiler is Visual Studio .NET 2003. The AMD64 and Itanium
binaries are created using the Platform SDK.</p>
<p><code class="xref py py-class docutils literal"><span class="pre">MSVCCompiler</span></code> will normally choose the right compiler, linker etc. on
its own. To override this choice, the environment variables <em>DISTUTILS_USE_SDK</em>
and <em>MSSdk</em> must be both set. <em>MSSdk</em> indicates that the current environment has
been setup by the SDK’s <code class="docutils literal"><span class="pre">SetEnv.Cmd</span></code> script, or that the environment variables
had been registered when the SDK was installed; <em>DISTUTILS_USE_SDK</em> indicates
that the distutils user has made an explicit choice to override the compiler
selection by <code class="xref py py-class docutils literal"><span class="pre">MSVCCompiler</span></code>.</p>
</div>
<div class="section" id="module-distutils.bcppcompiler">
<span id="distutils-bcppcompiler-borland-compiler"></span><h2>10.5. <a class="reference internal" href="#module-distutils.bcppcompiler" title="distutils.bcppcompiler"><code class="xref py py-mod docutils literal"><span class="pre">distutils.bcppcompiler</span></code></a> — Borland Compiler<a class="headerlink" href="#module-distutils.bcppcompiler" title="Permalink to this headline">¶</a></h2>
<p>This module provides <code class="xref py py-class docutils literal"><span class="pre">BorlandCCompiler</span></code>, a subclass of the abstract
<code class="xref py py-class docutils literal"><span class="pre">CCompiler</span></code> class for the Borland C++ compiler.</p>
</div>
<div class="section" id="module-distutils.cygwinccompiler">
<span id="distutils-cygwincompiler-cygwin-compiler"></span><h2>10.6. <code class="xref py py-mod docutils literal"><span class="pre">distutils.cygwincompiler</span></code> — Cygwin Compiler<a class="headerlink" href="#module-distutils.cygwinccompiler" title="Permalink to this headline">¶</a></h2>
<p>This module provides the <code class="xref py py-class docutils literal"><span class="pre">CygwinCCompiler</span></code> class, a subclass of
<code class="xref py py-class docutils literal"><span class="pre">UnixCCompiler</span></code> that handles the Cygwin port of the GNU C compiler to
Windows.  It also contains the Mingw32CCompiler class which handles the mingw32
port of GCC (same as cygwin in no-cygwin mode).</p>
</div>
<div class="section" id="module-distutils.archive_util">
<span id="distutils-archive-util-archiving-utilities"></span><h2>10.7. <a class="reference internal" href="#module-distutils.archive_util" title="distutils.archive_util: Utility functions for creating archive files (tarballs, zip files, ...)"><code class="xref py py-mod docutils literal"><span class="pre">distutils.archive_util</span></code></a> —  Archiving utilities<a class="headerlink" href="#module-distutils.archive_util" title="Permalink to this headline">¶</a></h2>
<p>This module provides a few functions for creating archive files, such as
tarballs or zipfiles.</p>
<dl class="function">
<dt id="distutils.archive_util.make_archive">
<code class="descclassname">distutils.archive_util.</code><code class="descname">make_archive</code><span class="sig-paren">(</span><em>base_name</em>, <em>format</em><span class="optional">[</span>, <em>root_dir=None</em>, <em>base_dir=None</em>, <em>verbose=0</em>, <em>dry_run=0</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#distutils.archive_util.make_archive" title="Permalink to this definition">¶</a></dt>
<dd><p>Create an archive file (eg. <code class="docutils literal"><span class="pre">zip</span></code> or <code class="docutils literal"><span class="pre">tar</span></code>).  <em>base_name</em>  is the name of
the file to create, minus any format-specific extension;  <em>format</em> is the
archive format: one of <code class="docutils literal"><span class="pre">zip</span></code>, <code class="docutils literal"><span class="pre">tar</span></code>, <code class="docutils literal"><span class="pre">gztar</span></code>, <code class="docutils literal"><span class="pre">bztar</span></code>, <code class="docutils literal"><span class="pre">xztar</span></code>, or
<code class="docutils literal"><span class="pre">ztar</span></code>. <em>root_dir</em> is a directory that will be the root directory of the
archive; ie. we typically <code class="docutils literal"><span class="pre">chdir</span></code> into <em>root_dir</em> before  creating the
archive.  <em>base_dir</em> is the directory where we start  archiving from; ie.
<em>base_dir</em> will be the common prefix of all files and directories in the
archive.  <em>root_dir</em> and <em>base_dir</em> both default to the current directory.
Returns the name of the archive file.</p>
<div class="versionchanged">
<p><span class="versionmodified">Changed in version 3.5: </span>Added support for the <code class="docutils literal"><span class="pre">xztar</span></code> format.</p>
</div>
</dd></dl>

<dl class="function">
<dt id="distutils.archive_util.make_tarball">
<code class="descclassname">distutils.archive_util.</code><code class="descname">make_tarball</code><span class="sig-paren">(</span><em>base_name</em>, <em>base_dir</em><span class="optional">[</span>, <em>compress='gzip'</em>, <em>verbose=0</em>, <em>dry_run=0</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#distutils.archive_util.make_tarball" title="Permalink to this definition">¶</a></dt>
<dd><p>‘Create an (optional compressed) archive as a tar file from all files in and
under <em>base_dir</em>. <em>compress</em> must be <code class="docutils literal"><span class="pre">'gzip'</span></code> (the default),
<code class="docutils literal"><span class="pre">'bzip2'</span></code>, <code class="docutils literal"><span class="pre">'xz'</span></code>, <code class="docutils literal"><span class="pre">'compress'</span></code>, or <code class="docutils literal"><span class="pre">None</span></code>.  For the <code class="docutils literal"><span class="pre">'compress'</span></code>
method the compression utility named by <strong class="program">compress</strong> must be on the
default program search path, so this is probably Unix-specific.  The output
tar file will be named <code class="file docutils literal"><span class="pre">base_dir.tar</span></code>, possibly plus the appropriate
compression extension (<code class="docutils literal"><span class="pre">.gz</span></code>, <code class="docutils literal"><span class="pre">.bz2</span></code>, <code class="docutils literal"><span class="pre">.xz</span></code> or <code class="docutils literal"><span class="pre">.Z</span></code>).  Return the
output filename.</p>
<div class="versionchanged">
<p><span class="versionmodified">Changed in version 3.5: </span>Added support for the <code class="docutils literal"><span class="pre">xz</span></code> compression.</p>
</div>
</dd></dl>

<dl class="function">
<dt id="distutils.archive_util.make_zipfile">
<code class="descclassname">distutils.archive_util.</code><code class="descname">make_zipfile</code><span class="sig-paren">(</span><em>base_name</em>, <em>base_dir</em><span class="optional">[</span>, <em>verbose=0</em>, <em>dry_run=0</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#distutils.archive_util.make_zipfile" title="Permalink to this definition">¶</a></dt>
<dd><p>Create a zip file from all files in and under <em>base_dir</em>.  The output zip file
will be named <em>base_name</em> + <code class="file docutils literal"><span class="pre">.zip</span></code>.  Uses either the  <a class="reference internal" href="../library/zipfile.html#module-zipfile" title="zipfile: Read and write ZIP-format archive files."><code class="xref py py-mod docutils literal"><span class="pre">zipfile</span></code></a> Python
module (if available) or the InfoZIP <code class="file docutils literal"><span class="pre">zip</span></code>  utility (if installed and
found on the default search path).  If neither  tool is available, raises
<code class="xref py py-exc docutils literal"><span class="pre">DistutilsExecError</span></code>.   Returns the name of the output zip file.</p>
</dd></dl>

</div>
<div class="section" id="module-distutils.dep_util">
<span id="distutils-dep-util-dependency-checking"></span><h2>10.8. <a class="reference internal" href="#module-distutils.dep_util" title="distutils.dep_util: Utility functions for simple dependency checking"><code class="xref py py-mod docutils literal"><span class="pre">distutils.dep_util</span></code></a> — Dependency checking<a class="headerlink" href="#module-distutils.dep_util" title="Permalink to this headline">¶</a></h2>
<p>This module provides functions for performing simple, timestamp-based
dependency of files and groups of files; also, functions based entirely  on such
timestamp dependency analysis.</p>
<dl class="function">
<dt id="distutils.dep_util.newer">
<code class="descclassname">distutils.dep_util.</code><code class="descname">newer</code><span class="sig-paren">(</span><em>source</em>, <em>target</em><span class="sig-paren">)</span><a class="headerlink" href="#distutils.dep_util.newer" title="Permalink to this definition">¶</a></dt>
<dd><p>Return true if <em>source</em> exists and is more recently modified than <em>target</em>, or
if <em>source</em> exists and <em>target</em> doesn’t. Return false if both exist and <em>target</em>
is the same age or newer  than <em>source</em>. Raise <code class="xref py py-exc docutils literal"><span class="pre">DistutilsFileError</span></code> if
<em>source</em> does not exist.</p>
</dd></dl>

<dl class="function">
<dt id="distutils.dep_util.newer_pairwise">
<code class="descclassname">distutils.dep_util.</code><code class="descname">newer_pairwise</code><span class="sig-paren">(</span><em>sources</em>, <em>targets</em><span class="sig-paren">)</span><a class="headerlink" href="#distutils.dep_util.newer_pairwise" title="Permalink to this definition">¶</a></dt>
<dd><p>Walk two filename lists in parallel, testing if each source is newer than its
corresponding target.  Return a pair of lists (<em>sources</em>, <em>targets</em>) where
source is newer than target, according to the semantics of <a class="reference internal" href="#distutils.dep_util.newer" title="distutils.dep_util.newer"><code class="xref py py-func docutils literal"><span class="pre">newer()</span></code></a>.</p>
</dd></dl>

<dl class="function">
<dt id="distutils.dep_util.newer_group">
<code class="descclassname">distutils.dep_util.</code><code class="descname">newer_group</code><span class="sig-paren">(</span><em>sources</em>, <em>target</em><span class="optional">[</span>, <em>missing='error'</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#distutils.dep_util.newer_group" title="Permalink to this definition">¶</a></dt>
<dd><p>Return true if <em>target</em> is out-of-date with respect to any file listed in
<em>sources</em>  In other words, if <em>target</em> exists and is newer than every file in
<em>sources</em>, return false; otherwise return true. <em>missing</em> controls what we do
when a source file is missing; the default (<code class="docutils literal"><span class="pre">'error'</span></code>) is to blow up with an
<a class="reference internal" href="../library/exceptions.html#OSError" title="OSError"><code class="xref py py-exc docutils literal"><span class="pre">OSError</span></code></a> from  inside <a class="reference internal" href="../library/os.html#os.stat" title="os.stat"><code class="xref py py-func docutils literal"><span class="pre">os.stat()</span></code></a>; if it is <code class="docutils literal"><span class="pre">'ignore'</span></code>, we silently
drop any missing source files; if it is <code class="docutils literal"><span class="pre">'newer'</span></code>, any missing source files
make us assume that <em>target</em> is out-of-date (this is handy in “dry-run” mode:
it’ll make you pretend to carry out commands that wouldn’t work because inputs
are missing, but that doesn’t matter because you’re not actually going to run
the commands).</p>
</dd></dl>

</div>
<div class="section" id="module-distutils.dir_util">
<span id="distutils-dir-util-directory-tree-operations"></span><h2>10.9. <a class="reference internal" href="#module-distutils.dir_util" title="distutils.dir_util: Utility functions for operating on directories and directory trees"><code class="xref py py-mod docutils literal"><span class="pre">distutils.dir_util</span></code></a> — Directory tree operations<a class="headerlink" href="#module-distutils.dir_util" title="Permalink to this headline">¶</a></h2>
<p>This module provides functions for operating on directories and trees of
directories.</p>
<dl class="function">
<dt id="distutils.dir_util.mkpath">
<code class="descclassname">distutils.dir_util.</code><code class="descname">mkpath</code><span class="sig-paren">(</span><em>name</em><span class="optional">[</span>, <em>mode=0o777</em>, <em>verbose=0</em>, <em>dry_run=0</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#distutils.dir_util.mkpath" title="Permalink to this definition">¶</a></dt>
<dd><p>Create a directory and any missing ancestor directories.  If the directory
already exists (or if <em>name</em> is the empty string, which means the current
directory, which of course exists), then do nothing.  Raise
<code class="xref py py-exc docutils literal"><span class="pre">DistutilsFileError</span></code> if unable to create some directory along the way (eg.
some sub-path exists, but is a file rather than a directory).  If <em>verbose</em> is
true, print a one-line summary of each mkdir to stdout.  Return the list of
directories actually created.</p>
</dd></dl>

<dl class="function">
<dt id="distutils.dir_util.create_tree">
<code class="descclassname">distutils.dir_util.</code><code class="descname">create_tree</code><span class="sig-paren">(</span><em>base_dir</em>, <em>files</em><span class="optional">[</span>, <em>mode=0o777</em>, <em>verbose=0</em>, <em>dry_run=0</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#distutils.dir_util.create_tree" title="Permalink to this definition">¶</a></dt>
<dd><p>Create all the empty directories under <em>base_dir</em> needed to put <em>files</em> there.
<em>base_dir</em> is just the name of a directory which doesn’t necessarily exist
yet; <em>files</em> is a list of filenames to be interpreted relative to <em>base_dir</em>.
<em>base_dir</em> + the directory portion of every file in <em>files</em> will be created if
it doesn’t already exist.  <em>mode</em>, <em>verbose</em> and <em>dry_run</em> flags  are as for
<a class="reference internal" href="#distutils.dir_util.mkpath" title="distutils.dir_util.mkpath"><code class="xref py py-func docutils literal"><span class="pre">mkpath()</span></code></a>.</p>
</dd></dl>

<dl class="function">
<dt id="distutils.dir_util.copy_tree">
<code class="descclassname">distutils.dir_util.</code><code class="descname">copy_tree</code><span class="sig-paren">(</span><em>src</em>, <em>dst</em><span class="optional">[</span>, <em>preserve_mode=1</em>, <em>preserve_times=1</em>, <em>preserve_symlinks=0</em>, <em>update=0</em>, <em>verbose=0</em>, <em>dry_run=0</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#distutils.dir_util.copy_tree" title="Permalink to this definition">¶</a></dt>
<dd><p>Copy an entire directory tree <em>src</em> to a new location <em>dst</em>.  Both <em>src</em> and
<em>dst</em> must be directory names.  If <em>src</em> is not a directory, raise
<code class="xref py py-exc docutils literal"><span class="pre">DistutilsFileError</span></code>.  If <em>dst</em> does  not exist, it is created with
<a class="reference internal" href="#distutils.dir_util.mkpath" title="distutils.dir_util.mkpath"><code class="xref py py-func docutils literal"><span class="pre">mkpath()</span></code></a>.  The end result of the  copy is that every file in <em>src</em> is
copied to <em>dst</em>, and  directories under <em>src</em> are recursively copied to <em>dst</em>.
Return the list of files that were copied or might have been copied, using their
output name. The return value is unaffected by <em>update</em> or <em>dry_run</em>: it is
simply the list of all files under <em>src</em>, with the names changed to be under
<em>dst</em>.</p>
<p><em>preserve_mode</em> and <em>preserve_times</em> are the same as for
<a class="reference internal" href="#distutils.file_util.copy_file" title="distutils.file_util.copy_file"><code class="xref py py-func docutils literal"><span class="pre">distutils.file_util.copy_file()</span></code></a>; note that they only apply to
regular files, not to
directories.  If <em>preserve_symlinks</em> is true, symlinks will be copied as
symlinks (on platforms that support them!); otherwise (the default), the
destination of the symlink will be copied.  <em>update</em> and <em>verbose</em> are the same
as for <code class="xref py py-func docutils literal"><span class="pre">copy_file()</span></code>.</p>
<p>Files in <em>src</em> that begin with <code class="file docutils literal"><span class="pre">.nfs</span></code> are skipped (more information on
these files is available in answer D2 of the <a class="reference external" href="http://nfs.sourceforge.net/#section_d">NFS FAQ page</a>).</p>
<div class="versionchanged">
<p><span class="versionmodified">Changed in version 3.3.1: </span>NFS files are ignored.</p>
</div>
</dd></dl>

<dl class="function">
<dt id="distutils.dir_util.remove_tree">
<code class="descclassname">distutils.dir_util.</code><code class="descname">remove_tree</code><span class="sig-paren">(</span><em>directory</em><span class="optional">[</span>, <em>verbose=0</em>, <em>dry_run=0</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#distutils.dir_util.remove_tree" title="Permalink to this definition">¶</a></dt>
<dd><p>Recursively remove <em>directory</em> and all files and directories underneath it. Any
errors are ignored (apart from being reported to <code class="docutils literal"><span class="pre">sys.stdout</span></code> if <em>verbose</em> is
true).</p>
</dd></dl>

</div>
<div class="section" id="module-distutils.file_util">
<span id="distutils-file-util-single-file-operations"></span><h2>10.10. <a class="reference internal" href="#module-distutils.file_util" title="distutils.file_util: Utility functions for operating on single files"><code class="xref py py-mod docutils literal"><span class="pre">distutils.file_util</span></code></a> — Single file operations<a class="headerlink" href="#module-distutils.file_util" title="Permalink to this headline">¶</a></h2>
<p>This module contains some utility functions for operating on individual files.</p>
<dl class="function">
<dt id="distutils.file_util.copy_file">
<code class="descclassname">distutils.file_util.</code><code class="descname">copy_file</code><span class="sig-paren">(</span><em>src</em>, <em>dst</em><span class="optional">[</span>, <em>preserve_mode=1</em>, <em>preserve_times=1</em>, <em>update=0</em>, <em>link=None</em>, <em>verbose=0</em>, <em>dry_run=0</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#distutils.file_util.copy_file" title="Permalink to this definition">¶</a></dt>
<dd><p>Copy file <em>src</em> to <em>dst</em>. If <em>dst</em> is a directory, then <em>src</em> is copied there
with the same name; otherwise, it must be a filename. (If the file exists, it
will be ruthlessly clobbered.) If <em>preserve_mode</em> is true (the default), the
file’s mode (type and permission bits, or whatever is analogous on the
current platform) is copied. If <em>preserve_times</em> is true (the default), the
last-modified and last-access times are copied as well. If <em>update</em> is true,
<em>src</em> will only be copied if <em>dst</em> does not exist, or if <em>dst</em> does exist but
is older than <em>src</em>.</p>
<p><em>link</em> allows you to make hard links (using <a class="reference internal" href="../library/os.html#os.link" title="os.link"><code class="xref py py-func docutils literal"><span class="pre">os.link()</span></code></a>) or symbolic links
(using <a class="reference internal" href="../library/os.html#os.symlink" title="os.symlink"><code class="xref py py-func docutils literal"><span class="pre">os.symlink()</span></code></a>) instead of copying: set it to <code class="docutils literal"><span class="pre">'hard'</span></code> or
<code class="docutils literal"><span class="pre">'sym'</span></code>; if it is <code class="docutils literal"><span class="pre">None</span></code> (the default), files are copied. Don’t set <em>link</em>
on systems that don’t support it: <a class="reference internal" href="#distutils.file_util.copy_file" title="distutils.file_util.copy_file"><code class="xref py py-func docutils literal"><span class="pre">copy_file()</span></code></a> doesn’t check if hard or
symbolic linking is available.  It uses <code class="xref py py-func docutils literal"><span class="pre">_copy_file_contents()</span></code> to copy file
contents.</p>
<p>Return a tuple <code class="docutils literal"><span class="pre">(dest_name,</span> <span class="pre">copied)</span></code>: <em>dest_name</em> is the actual  name of the
output file, and <em>copied</em> is true if the file was copied  (or would have been
copied, if <em>dry_run</em> true).</p>
</dd></dl>

<dl class="function">
<dt id="distutils.file_util.move_file">
<code class="descclassname">distutils.file_util.</code><code class="descname">move_file</code><span class="sig-paren">(</span><em>src</em>, <em>dst</em><span class="optional">[</span>, <em>verbose</em>, <em>dry_run</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#distutils.file_util.move_file" title="Permalink to this definition">¶</a></dt>
<dd><p>Move file <em>src</em> to <em>dst</em>. If <em>dst</em> is a directory, the file will be moved into
it with the same name; otherwise, <em>src</em> is just renamed to <em>dst</em>.  Returns the
new full name of the file.</p>
<div class="admonition warning">
<p class="first admonition-title">Warning</p>
<p class="last">Handles cross-device moves on Unix using <a class="reference internal" href="#distutils.file_util.copy_file" title="distutils.file_util.copy_file"><code class="xref py py-func docutils literal"><span class="pre">copy_file()</span></code></a>.  What about
other systems?</p>
</div>
</dd></dl>

<dl class="function">
<dt id="distutils.file_util.write_file">
<code class="descclassname">distutils.file_util.</code><code class="descname">write_file</code><span class="sig-paren">(</span><em>filename</em>, <em>contents</em><span class="sig-paren">)</span><a class="headerlink" href="#distutils.file_util.write_file" title="Permalink to this definition">¶</a></dt>
<dd><p>Create a file called <em>filename</em> and write <em>contents</em> (a sequence of strings
without line terminators) to it.</p>
</dd></dl>

</div>
<div class="section" id="module-distutils.util">
<span id="distutils-util-miscellaneous-other-utility-functions"></span><h2>10.11. <a class="reference internal" href="#module-distutils.util" title="distutils.util: Miscellaneous other utility functions"><code class="xref py py-mod docutils literal"><span class="pre">distutils.util</span></code></a> — Miscellaneous other utility functions<a class="headerlink" href="#module-distutils.util" title="Permalink to this headline">¶</a></h2>
<p>This module contains other assorted bits and pieces that don’t fit into  any
other utility module.</p>
<dl class="function">
<dt id="distutils.util.get_platform">
<code class="descclassname">distutils.util.</code><code class="descname">get_platform</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#distutils.util.get_platform" title="Permalink to this definition">¶</a></dt>
<dd><p>Return a string that identifies the current platform.  This is used mainly to
distinguish platform-specific build directories and platform-specific built
distributions.  Typically includes the OS name and version and the architecture
(as supplied by ‘os.uname()’), although the exact information included depends
on the OS; eg. for IRIX the architecture isn’t particularly important (IRIX only
runs on SGI hardware), but for Linux the kernel version isn’t particularly
important.</p>
<p>Examples of returned values:</p>
<ul class="simple">
<li><code class="docutils literal"><span class="pre">linux-i586</span></code></li>
<li><code class="docutils literal"><span class="pre">linux-alpha</span></code></li>
<li><code class="docutils literal"><span class="pre">solaris-2.6-sun4u</span></code></li>
<li><code class="docutils literal"><span class="pre">irix-5.3</span></code></li>
<li><code class="docutils literal"><span class="pre">irix64-6.2</span></code></li>
</ul>
<p>For non-POSIX platforms, currently just returns <code class="docutils literal"><span class="pre">sys.platform</span></code>.</p>
<p>For Mac OS X systems the OS version reflects the minimal version on which
binaries will run (that is, the value of <code class="docutils literal"><span class="pre">MACOSX_DEPLOYMENT_TARGET</span></code>
during the build of Python), not the OS version of the current system.</p>
<p>For universal binary builds on Mac OS X the architecture value reflects
the universal binary status instead of the architecture of the current
processor. For 32-bit universal binaries the architecture is <code class="docutils literal"><span class="pre">fat</span></code>,
for 64-bit universal binaries the architecture is <code class="docutils literal"><span class="pre">fat64</span></code>, and
for 4-way universal binaries the architecture is <code class="docutils literal"><span class="pre">universal</span></code>. Starting
from Python 2.7 and Python 3.2 the architecture <code class="docutils literal"><span class="pre">fat3</span></code> is used for
a 3-way universal build (ppc, i386, x86_64) and <code class="docutils literal"><span class="pre">intel</span></code> is used for
a universal build with the i386 and x86_64 architectures</p>
<p>Examples of returned values on Mac OS X:</p>
<ul class="simple">
<li><code class="docutils literal"><span class="pre">macosx-10.3-ppc</span></code></li>
<li><code class="docutils literal"><span class="pre">macosx-10.3-fat</span></code></li>
<li><code class="docutils literal"><span class="pre">macosx-10.5-universal</span></code></li>
<li><code class="docutils literal"><span class="pre">macosx-10.6-intel</span></code></li>
</ul>
</dd></dl>

<dl class="function">
<dt id="distutils.util.convert_path">
<code class="descclassname">distutils.util.</code><code class="descname">convert_path</code><span class="sig-paren">(</span><em>pathname</em><span class="sig-paren">)</span><a class="headerlink" href="#distutils.util.convert_path" title="Permalink to this definition">¶</a></dt>
<dd><p>Return ‘pathname’ as a name that will work on the native filesystem, i.e. split
it on ‘/’ and put it back together again using the current directory separator.
Needed because filenames in the setup script are always supplied in Unix style,
and have to be converted to the local convention before we can actually use them
in the filesystem.  Raises <a class="reference internal" href="../library/exceptions.html#ValueError" title="ValueError"><code class="xref py py-exc docutils literal"><span class="pre">ValueError</span></code></a> on non-Unix-ish systems if
<em>pathname</em> either  starts or ends with a slash.</p>
</dd></dl>

<dl class="function">
<dt id="distutils.util.change_root">
<code class="descclassname">distutils.util.</code><code class="descname">change_root</code><span class="sig-paren">(</span><em>new_root</em>, <em>pathname</em><span class="sig-paren">)</span><a class="headerlink" href="#distutils.util.change_root" title="Permalink to this definition">¶</a></dt>
<dd><p>Return <em>pathname</em> with <em>new_root</em> prepended.  If <em>pathname</em> is relative, this is
equivalent to <code class="docutils literal"><span class="pre">os.path.join(new_root,pathname)</span></code> Otherwise, it requires making
<em>pathname</em> relative and then joining the two, which is tricky on DOS/Windows.</p>
</dd></dl>

<dl class="function">
<dt id="distutils.util.check_environ">
<code class="descclassname">distutils.util.</code><code class="descname">check_environ</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#distutils.util.check_environ" title="Permalink to this definition">¶</a></dt>
<dd><p>Ensure that ‘os.environ’ has all the environment variables we guarantee that
users can use in config files, command-line options, etc.  Currently this
includes:</p>
<ul class="simple">
<li><span class="target" id="index-1"></span><code class="xref std std-envvar docutils literal"><span class="pre">HOME</span></code> - user’s home directory (Unix only)</li>
<li><span class="target" id="index-2"></span><code class="xref std std-envvar docutils literal"><span class="pre">PLAT</span></code> - description of the current platform, including hardware and
OS (see <a class="reference internal" href="#distutils.util.get_platform" title="distutils.util.get_platform"><code class="xref py py-func docutils literal"><span class="pre">get_platform()</span></code></a>)</li>
</ul>
</dd></dl>

<dl class="function">
<dt id="distutils.util.subst_vars">
<code class="descclassname">distutils.util.</code><code class="descname">subst_vars</code><span class="sig-paren">(</span><em>s</em>, <em>local_vars</em><span class="sig-paren">)</span><a class="headerlink" href="#distutils.util.subst_vars" title="Permalink to this definition">¶</a></dt>
<dd><p>Perform shell/Perl-style variable substitution on <em>s</em>.  Every occurrence of
<code class="docutils literal"><span class="pre">$</span></code> followed by a name is considered a variable, and variable is substituted
by the value found in the <em>local_vars</em> dictionary, or in <code class="docutils literal"><span class="pre">os.environ</span></code> if it’s
not in <em>local_vars</em>. <em>os.environ</em> is first checked/augmented to guarantee that
it contains certain values: see <a class="reference internal" href="#distutils.util.check_environ" title="distutils.util.check_environ"><code class="xref py py-func docutils literal"><span class="pre">check_environ()</span></code></a>.  Raise <a class="reference internal" href="../library/exceptions.html#ValueError" title="ValueError"><code class="xref py py-exc docutils literal"><span class="pre">ValueError</span></code></a>
for any variables not found in either <em>local_vars</em> or <code class="docutils literal"><span class="pre">os.environ</span></code>.</p>
<p>Note that this is not a fully-fledged string interpolation function. A valid
<code class="docutils literal"><span class="pre">$variable</span></code> can consist only of upper and lower case letters, numbers and an
underscore. No { } or ( ) style quoting is available.</p>
</dd></dl>

<dl class="function">
<dt id="distutils.util.split_quoted">
<code class="descclassname">distutils.util.</code><code class="descname">split_quoted</code><span class="sig-paren">(</span><em>s</em><span class="sig-paren">)</span><a class="headerlink" href="#distutils.util.split_quoted" title="Permalink to this definition">¶</a></dt>
<dd><p>Split a string up according to Unix shell-like rules for quotes and backslashes.
In short: words are delimited by spaces, as long as those spaces are not escaped
by a backslash, or inside a quoted string. Single and double quotes are
equivalent, and the quote characters can be backslash-escaped.  The backslash is
stripped from any two-character escape sequence, leaving only the escaped
character.  The quote characters are stripped from any quoted string.  Returns a
list of words.</p>
</dd></dl>

<dl class="function">
<dt id="distutils.util.execute">
<code class="descclassname">distutils.util.</code><code class="descname">execute</code><span class="sig-paren">(</span><em>func</em>, <em>args</em><span class="optional">[</span>, <em>msg=None</em>, <em>verbose=0</em>, <em>dry_run=0</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#distutils.util.execute" title="Permalink to this definition">¶</a></dt>
<dd><p>Perform some action that affects the outside world (for instance, writing to the
filesystem).  Such actions are special because they are disabled by the
<em>dry_run</em> flag.  This method takes  care of all that bureaucracy for you; all
you have to do is supply the function to call and an argument tuple for it (to
embody the “external action” being performed), and an optional message to print.</p>
</dd></dl>

<dl class="function">
<dt id="distutils.util.strtobool">
<code class="descclassname">distutils.util.</code><code class="descname">strtobool</code><span class="sig-paren">(</span><em>val</em><span class="sig-paren">)</span><a class="headerlink" href="#distutils.util.strtobool" title="Permalink to this definition">¶</a></dt>
<dd><p>Convert a string representation of truth to true (1) or false (0).</p>
<p>True values are <code class="docutils literal"><span class="pre">y</span></code>, <code class="docutils literal"><span class="pre">yes</span></code>, <code class="docutils literal"><span class="pre">t</span></code>, <code class="docutils literal"><span class="pre">true</span></code>, <code class="docutils literal"><span class="pre">on</span></code>  and <code class="docutils literal"><span class="pre">1</span></code>; false values
are <code class="docutils literal"><span class="pre">n</span></code>, <code class="docutils literal"><span class="pre">no</span></code>, <code class="docutils literal"><span class="pre">f</span></code>, <code class="docutils literal"><span class="pre">false</span></code>,  <code class="docutils literal"><span class="pre">off</span></code> and <code class="docutils literal"><span class="pre">0</span></code>.  Raises
<a class="reference internal" href="../library/exceptions.html#ValueError" title="ValueError"><code class="xref py py-exc docutils literal"><span class="pre">ValueError</span></code></a> if <em>val</em>  is anything else.</p>
</dd></dl>

<dl class="function">
<dt id="distutils.util.byte_compile">
<code class="descclassname">distutils.util.</code><code class="descname">byte_compile</code><span class="sig-paren">(</span><em>py_files</em><span class="optional">[</span>, <em>optimize=0</em>, <em>force=0</em>, <em>prefix=None</em>, <em>base_dir=None</em>, <em>verbose=1</em>, <em>dry_run=0</em>, <em>direct=None</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#distutils.util.byte_compile" title="Permalink to this definition">¶</a></dt>
<dd><p>Byte-compile a collection of Python source files to <code class="file docutils literal"><span class="pre">.pyc</span></code> files in a
<code class="file docutils literal"><span class="pre">__pycache__</span></code> subdirectory (see <span class="target" id="index-3"></span><a class="pep reference external" href="https://www.python.org/dev/peps/pep-3147"><strong>PEP 3147</strong></a> and <span class="target" id="index-4"></span><a class="pep reference external" href="https://www.python.org/dev/peps/pep-0488"><strong>PEP 488</strong></a>).
<em>py_files</em> is a list of files to compile; any files that don’t end in
<code class="file docutils literal"><span class="pre">.py</span></code> are silently skipped.  <em>optimize</em> must be one of the following:</p>
<ul class="simple">
<li><code class="docutils literal"><span class="pre">0</span></code> - don’t optimize</li>
<li><code class="docutils literal"><span class="pre">1</span></code> - normal optimization (like <code class="docutils literal"><span class="pre">python</span> <span class="pre">-O</span></code>)</li>
<li><code class="docutils literal"><span class="pre">2</span></code> - extra optimization (like <code class="docutils literal"><span class="pre">python</span> <span class="pre">-OO</span></code>)</li>
</ul>
<p>If <em>force</em> is true, all files are recompiled regardless of timestamps.</p>
<p>The source filename encoded in each <a class="reference internal" href="../glossary.html#term-bytecode"><span class="xref std std-term">bytecode</span></a> file defaults to the filenames
listed in <em>py_files</em>; you can modify these with <em>prefix</em> and <em>basedir</em>.
<em>prefix</em> is a string that will be stripped off of each source filename, and
<em>base_dir</em> is a directory name that will be prepended (after <em>prefix</em> is
stripped).  You can supply either or both (or neither) of <em>prefix</em> and
<em>base_dir</em>, as you wish.</p>
<p>If <em>dry_run</em> is true, doesn’t actually do anything that would affect the
filesystem.</p>
<p>Byte-compilation is either done directly in this interpreter process with the
standard <a class="reference internal" href="../library/py_compile.html#module-py_compile" title="py_compile: Generate byte-code files from Python source files."><code class="xref py py-mod docutils literal"><span class="pre">py_compile</span></code></a> module, or indirectly by writing a temporary script
and executing it.  Normally, you should let <a class="reference internal" href="#distutils.util.byte_compile" title="distutils.util.byte_compile"><code class="xref py py-func docutils literal"><span class="pre">byte_compile()</span></code></a> figure out to
use direct compilation or not (see the source for details).  The <em>direct</em> flag
is used by the script generated in indirect mode; unless you know what you’re
doing, leave it set to <code class="docutils literal"><span class="pre">None</span></code>.</p>
<div class="versionchanged">
<p><span class="versionmodified">Changed in version 3.2.3: </span>Create <code class="docutils literal"><span class="pre">.pyc</span></code> files with an <a class="reference internal" href="../library/imp.html#imp.get_tag" title="imp.get_tag"><code class="xref py py-func docutils literal"><span class="pre">import</span> <span class="pre">magic</span> <span class="pre">tag</span></code></a> in their name, in a <code class="file docutils literal"><span class="pre">__pycache__</span></code> subdirectory
instead of files without tag in the current directory.</p>
</div>
<div class="versionchanged">
<p><span class="versionmodified">Changed in version 3.5: </span>Create <code class="docutils literal"><span class="pre">.pyc</span></code> files according to <span class="target" id="index-5"></span><a class="pep reference external" href="https://www.python.org/dev/peps/pep-0488"><strong>PEP 488</strong></a>.</p>
</div>
</dd></dl>

<dl class="function">
<dt id="distutils.util.rfc822_escape">
<code class="descclassname">distutils.util.</code><code class="descname">rfc822_escape</code><span class="sig-paren">(</span><em>header</em><span class="sig-paren">)</span><a class="headerlink" href="#distutils.util.rfc822_escape" title="Permalink to this definition">¶</a></dt>
<dd><p>Return a version of <em>header</em> escaped for inclusion in an <span class="target" id="index-6"></span><a class="rfc reference external" href="https://tools.ietf.org/html/rfc822.html"><strong>RFC 822</strong></a> header, by
ensuring there are 8 spaces space after each newline. Note that it does no other
modification of the string.</p>
</dd></dl>

</div>
<div class="section" id="module-distutils.dist">
<span id="distutils-dist-the-distribution-class"></span><h2>10.12. <a class="reference internal" href="#module-distutils.dist" title="distutils.dist: Provides the Distribution class, which represents the module distribution being built/installed/distributed"><code class="xref py py-mod docutils literal"><span class="pre">distutils.dist</span></code></a> — The Distribution class<a class="headerlink" href="#module-distutils.dist" title="Permalink to this headline">¶</a></h2>
<p>This module provides the <a class="reference internal" href="#distutils.core.Distribution" title="distutils.core.Distribution"><code class="xref py py-class docutils literal"><span class="pre">Distribution</span></code></a> class, which
represents the module distribution being built/installed/distributed.</p>
</div>
<div class="section" id="module-distutils.extension">
<span id="distutils-extension-the-extension-class"></span><h2>10.13. <a class="reference internal" href="#module-distutils.extension" title="distutils.extension: Provides the Extension class, used to describe C/C++ extension modules in setup scripts"><code class="xref py py-mod docutils literal"><span class="pre">distutils.extension</span></code></a> — The Extension class<a class="headerlink" href="#module-distutils.extension" title="Permalink to this headline">¶</a></h2>
<p>This module provides the <code class="xref py py-class docutils literal"><span class="pre">Extension</span></code> class, used to describe C/C++
extension modules in setup scripts.</p>
</div>
<div class="section" id="module-distutils.debug">
<span id="distutils-debug-distutils-debug-mode"></span><h2>10.14. <a class="reference internal" href="#module-distutils.debug" title="distutils.debug: Provides the debug flag for distutils"><code class="xref py py-mod docutils literal"><span class="pre">distutils.debug</span></code></a> — Distutils debug mode<a class="headerlink" href="#module-distutils.debug" title="Permalink to this headline">¶</a></h2>
<p>This module provides the DEBUG flag.</p>
</div>
<div class="section" id="module-distutils.errors">
<span id="distutils-errors-distutils-exceptions"></span><h2>10.15. <a class="reference internal" href="#module-distutils.errors" title="distutils.errors: Provides standard distutils exceptions"><code class="xref py py-mod docutils literal"><span class="pre">distutils.errors</span></code></a> — Distutils exceptions<a class="headerlink" href="#module-distutils.errors" title="Permalink to this headline">¶</a></h2>
<p>Provides exceptions used by the Distutils modules.  Note that Distutils modules
may raise standard exceptions; in particular, SystemExit is usually raised for
errors that are obviously the end-user’s fault (eg. bad command-line arguments).</p>
<p>This module is safe to use in <code class="docutils literal"><span class="pre">from</span> <span class="pre">...</span> <span class="pre">import</span> <span class="pre">*</span></code> mode; it only exports
symbols whose names start with <code class="docutils literal"><span class="pre">Distutils</span></code> and end with <code class="docutils literal"><span class="pre">Error</span></code>.</p>
</div>
<div class="section" id="module-distutils.fancy_getopt">
<span id="distutils-fancy-getopt-wrapper-around-the-standard-getopt-module"></span><h2>10.16. <a class="reference internal" href="#module-distutils.fancy_getopt" title="distutils.fancy_getopt: Additional getopt functionality"><code class="xref py py-mod docutils literal"><span class="pre">distutils.fancy_getopt</span></code></a> — Wrapper around the standard getopt module<a class="headerlink" href="#module-distutils.fancy_getopt" title="Permalink to this headline">¶</a></h2>
<p>This module provides a wrapper around the standard <a class="reference internal" href="../library/getopt.html#module-getopt" title="getopt: Portable parser for command line options; support both short and long option names."><code class="xref py py-mod docutils literal"><span class="pre">getopt</span></code></a>  module that
provides the following additional features:</p>
<ul class="simple">
<li>short and long options are tied together</li>
<li>options have help strings, so <a class="reference internal" href="#distutils.fancy_getopt.fancy_getopt" title="distutils.fancy_getopt.fancy_getopt"><code class="xref py py-func docutils literal"><span class="pre">fancy_getopt()</span></code></a> could potentially  create a
complete usage summary</li>
<li>options set attributes of a passed-in object</li>
<li>boolean options can have “negative aliases” — eg. if <code class="xref std std-option docutils literal"><span class="pre">--quiet</span></code> is
the “negative alias” of <code class="xref std std-option docutils literal"><span class="pre">--verbose</span></code>, then <code class="xref std std-option docutils literal"><span class="pre">--quiet</span></code> on the
command line sets <em>verbose</em> to false.</li>
</ul>
<dl class="function">
<dt id="distutils.fancy_getopt.fancy_getopt">
<code class="descclassname">distutils.fancy_getopt.</code><code class="descname">fancy_getopt</code><span class="sig-paren">(</span><em>options</em>, <em>negative_opt</em>, <em>object</em>, <em>args</em><span class="sig-paren">)</span><a class="headerlink" href="#distutils.fancy_getopt.fancy_getopt" title="Permalink to this definition">¶</a></dt>
<dd><p>Wrapper function. <em>options</em> is a list of <code class="docutils literal"><span class="pre">(long_option,</span> <span class="pre">short_option,</span>
<span class="pre">help_string)</span></code> 3-tuples as described in the constructor for
<a class="reference internal" href="#distutils.fancy_getopt.FancyGetopt" title="distutils.fancy_getopt.FancyGetopt"><code class="xref py py-class docutils literal"><span class="pre">FancyGetopt</span></code></a>. <em>negative_opt</em> should be a dictionary mapping option names
to option names, both the key and value should be in the <em>options</em> list.
<em>object</em> is an object which will be used to store values (see the <a class="reference internal" href="../library/getopt.html#module-getopt" title="getopt: Portable parser for command line options; support both short and long option names."><code class="xref py py-meth docutils literal"><span class="pre">getopt()</span></code></a>
method of the <a class="reference internal" href="#distutils.fancy_getopt.FancyGetopt" title="distutils.fancy_getopt.FancyGetopt"><code class="xref py py-class docutils literal"><span class="pre">FancyGetopt</span></code></a> class). <em>args</em> is the argument list. Will use
<code class="docutils literal"><span class="pre">sys.argv[1:]</span></code> if you  pass <code class="docutils literal"><span class="pre">None</span></code> as <em>args</em>.</p>
</dd></dl>

<dl class="function">
<dt id="distutils.fancy_getopt.wrap_text">
<code class="descclassname">distutils.fancy_getopt.</code><code class="descname">wrap_text</code><span class="sig-paren">(</span><em>text</em>, <em>width</em><span class="sig-paren">)</span><a class="headerlink" href="#distutils.fancy_getopt.wrap_text" title="Permalink to this definition">¶</a></dt>
<dd><p>Wraps <em>text</em> to less than <em>width</em> wide.</p>
</dd></dl>

<dl class="class">
<dt id="distutils.fancy_getopt.FancyGetopt">
<em class="property">class </em><code class="descclassname">distutils.fancy_getopt.</code><code class="descname">FancyGetopt</code><span class="sig-paren">(</span><span class="optional">[</span><em>option_table=None</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#distutils.fancy_getopt.FancyGetopt" title="Permalink to this definition">¶</a></dt>
<dd><p>The option_table is a list of 3-tuples: <code class="docutils literal"><span class="pre">(long_option,</span> <span class="pre">short_option,</span>
<span class="pre">help_string)</span></code></p>
<p>If an option takes an argument, its <em>long_option</em> should have <code class="docutils literal"><span class="pre">'='</span></code> appended;
<em>short_option</em> should just be a single character, no <code class="docutils literal"><span class="pre">':'</span></code> in any case.
<em>short_option</em> should be <code class="docutils literal"><span class="pre">None</span></code> if a <em>long_option</em>  doesn’t have a
corresponding <em>short_option</em>. All option tuples must have long options.</p>
</dd></dl>

<p>The <a class="reference internal" href="#distutils.fancy_getopt.FancyGetopt" title="distutils.fancy_getopt.FancyGetopt"><code class="xref py py-class docutils literal"><span class="pre">FancyGetopt</span></code></a> class provides the following methods:</p>
<dl class="method">
<dt id="distutils.fancy_getopt.FancyGetopt.getopt">
<code class="descclassname">FancyGetopt.</code><code class="descname">getopt</code><span class="sig-paren">(</span><span class="optional">[</span><em>args=None</em>, <em>object=None</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#distutils.fancy_getopt.FancyGetopt.getopt" title="Permalink to this definition">¶</a></dt>
<dd><p>Parse command-line options in args. Store as attributes on <em>object</em>.</p>
<p>If <em>args</em> is <code class="docutils literal"><span class="pre">None</span></code> or not supplied, uses <code class="docutils literal"><span class="pre">sys.argv[1:]</span></code>.  If <em>object</em> is
<code class="docutils literal"><span class="pre">None</span></code> or not supplied, creates a new <code class="xref py py-class docutils literal"><span class="pre">OptionDummy</span></code> instance, stores
option values there, and returns a tuple <code class="docutils literal"><span class="pre">(args,</span> <span class="pre">object)</span></code>.  If <em>object</em> is
supplied, it is modified in place and <a class="reference internal" href="../library/getopt.html#module-getopt" title="getopt: Portable parser for command line options; support both short and long option names."><code class="xref py py-func docutils literal"><span class="pre">getopt()</span></code></a> just returns <em>args</em>; in
both cases, the returned <em>args</em> is a modified copy of the passed-in <em>args</em> list,
which is left untouched.</p>
</dd></dl>

<dl class="method">
<dt id="distutils.fancy_getopt.FancyGetopt.get_option_order">
<code class="descclassname">FancyGetopt.</code><code class="descname">get_option_order</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#distutils.fancy_getopt.FancyGetopt.get_option_order" title="Permalink to this definition">¶</a></dt>
<dd><p>Returns the list of <code class="docutils literal"><span class="pre">(option,</span> <span class="pre">value)</span></code> tuples processed by the previous run of
<a class="reference internal" href="../library/getopt.html#module-getopt" title="getopt: Portable parser for command line options; support both short and long option names."><code class="xref py py-meth docutils literal"><span class="pre">getopt()</span></code></a>  Raises <a class="reference internal" href="../library/exceptions.html#RuntimeError" title="RuntimeError"><code class="xref py py-exc docutils literal"><span class="pre">RuntimeError</span></code></a> if <a class="reference internal" href="../library/getopt.html#module-getopt" title="getopt: Portable parser for command line options; support both short and long option names."><code class="xref py py-meth docutils literal"><span class="pre">getopt()</span></code></a> hasn’t been called
yet.</p>
</dd></dl>

<dl class="method">
<dt id="distutils.fancy_getopt.FancyGetopt.generate_help">
<code class="descclassname">FancyGetopt.</code><code class="descname">generate_help</code><span class="sig-paren">(</span><span class="optional">[</span><em>header=None</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#distutils.fancy_getopt.FancyGetopt.generate_help" title="Permalink to this definition">¶</a></dt>
<dd><p>Generate help text (a list of strings, one per suggested line of output) from
the option table for this <a class="reference internal" href="#distutils.fancy_getopt.FancyGetopt" title="distutils.fancy_getopt.FancyGetopt"><code class="xref py py-class docutils literal"><span class="pre">FancyGetopt</span></code></a> object.</p>
<p>If supplied, prints the supplied <em>header</em> at the top of the help.</p>
</dd></dl>

</div>
<div class="section" id="module-distutils.filelist">
<span id="distutils-filelist-the-filelist-class"></span><h2>10.17. <a class="reference internal" href="#module-distutils.filelist" title="distutils.filelist: The FileList class, used for poking about the file system and building lists of files."><code class="xref py py-mod docutils literal"><span class="pre">distutils.filelist</span></code></a> — The FileList class<a class="headerlink" href="#module-distutils.filelist" title="Permalink to this headline">¶</a></h2>
<p>This module provides the <code class="xref py py-class docutils literal"><span class="pre">FileList</span></code> class, used for poking about the
filesystem and building lists of files.</p>
</div>
<div class="section" id="module-distutils.log">
<span id="distutils-log-simple-pep-282-style-logging"></span><h2>10.18. <a class="reference internal" href="#module-distutils.log" title="distutils.log: A simple logging mechanism, 282-style"><code class="xref py py-mod docutils literal"><span class="pre">distutils.log</span></code></a> — Simple PEP 282-style logging<a class="headerlink" href="#module-distutils.log" title="Permalink to this headline">¶</a></h2>
</div>
<div class="section" id="module-distutils.spawn">
<span id="distutils-spawn-spawn-a-sub-process"></span><h2>10.19. <a class="reference internal" href="#module-distutils.spawn" title="distutils.spawn: Provides the spawn() function"><code class="xref py py-mod docutils literal"><span class="pre">distutils.spawn</span></code></a> — Spawn a sub-process<a class="headerlink" href="#module-distutils.spawn" title="Permalink to this headline">¶</a></h2>
<p>This module provides the <code class="xref py py-func docutils literal"><span class="pre">spawn()</span></code> function, a front-end to  various
platform-specific functions for launching another program in a  sub-process.
Also provides <code class="xref py py-func docutils literal"><span class="pre">find_executable()</span></code> to search the path for a given executable
name.</p>
</div>
<div class="section" id="module-distutils.sysconfig">
<span id="distutils-sysconfig-system-configuration-information"></span><h2>10.20. <a class="reference internal" href="#module-distutils.sysconfig" title="distutils.sysconfig: Low-level access to configuration information of the Python interpreter."><code class="xref py py-mod docutils literal"><span class="pre">distutils.sysconfig</span></code></a> — System configuration information<a class="headerlink" href="#module-distutils.sysconfig" title="Permalink to this headline">¶</a></h2>
<p>The <a class="reference internal" href="#module-distutils.sysconfig" title="distutils.sysconfig: Low-level access to configuration information of the Python interpreter."><code class="xref py py-mod docutils literal"><span class="pre">distutils.sysconfig</span></code></a> module provides access to Python’s low-level
configuration information.  The specific configuration variables available
depend heavily on the platform and configuration. The specific variables depend
on the build process for the specific version of Python being run; the variables
are those found in the <code class="file docutils literal"><span class="pre">Makefile</span></code> and configuration header that are
installed with Python on Unix systems.  The configuration header is called
<code class="file docutils literal"><span class="pre">pyconfig.h</span></code> for Python versions starting with 2.2, and <code class="file docutils literal"><span class="pre">config.h</span></code>
for earlier versions of Python.</p>
<p>Some additional functions are provided which perform some useful manipulations
for other parts of the <a class="reference internal" href="../library/distutils.html#module-distutils" title="distutils: Support for building and installing Python modules into an existing Python installation."><code class="xref py py-mod docutils literal"><span class="pre">distutils</span></code></a> package.</p>
<dl class="data">
<dt id="distutils.sysconfig.PREFIX">
<code class="descclassname">distutils.sysconfig.</code><code class="descname">PREFIX</code><a class="headerlink" href="#distutils.sysconfig.PREFIX" title="Permalink to this definition">¶</a></dt>
<dd><p>The result of <code class="docutils literal"><span class="pre">os.path.normpath(sys.prefix)</span></code>.</p>
</dd></dl>

<dl class="data">
<dt id="distutils.sysconfig.EXEC_PREFIX">
<code class="descclassname">distutils.sysconfig.</code><code class="descname">EXEC_PREFIX</code><a class="headerlink" href="#distutils.sysconfig.EXEC_PREFIX" title="Permalink to this definition">¶</a></dt>
<dd><p>The result of <code class="docutils literal"><span class="pre">os.path.normpath(sys.exec_prefix)</span></code>.</p>
</dd></dl>

<dl class="function">
<dt id="distutils.sysconfig.get_config_var">
<code class="descclassname">distutils.sysconfig.</code><code class="descname">get_config_var</code><span class="sig-paren">(</span><em>name</em><span class="sig-paren">)</span><a class="headerlink" href="#distutils.sysconfig.get_config_var" title="Permalink to this definition">¶</a></dt>
<dd><p>Return the value of a single variable.  This is equivalent to
<code class="docutils literal"><span class="pre">get_config_vars().get(name)</span></code>.</p>
</dd></dl>

<dl class="function">
<dt id="distutils.sysconfig.get_config_vars">
<code class="descclassname">distutils.sysconfig.</code><code class="descname">get_config_vars</code><span class="sig-paren">(</span><em>...</em><span class="sig-paren">)</span><a class="headerlink" href="#distutils.sysconfig.get_config_vars" title="Permalink to this definition">¶</a></dt>
<dd><p>Return a set of variable definitions.  If there are no arguments, this returns a
dictionary mapping names of configuration variables to values.  If arguments are
provided, they should be strings, and the return value will be a sequence giving
the associated values. If a given name does not have a corresponding value,
<code class="docutils literal"><span class="pre">None</span></code> will be included for that variable.</p>
</dd></dl>

<dl class="function">
<dt id="distutils.sysconfig.get_config_h_filename">
<code class="descclassname">distutils.sysconfig.</code><code class="descname">get_config_h_filename</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#distutils.sysconfig.get_config_h_filename" title="Permalink to this definition">¶</a></dt>
<dd><p>Return the full path name of the configuration header.  For Unix, this will be
the header generated by the <strong class="program">configure</strong> script; for other platforms the
header will have been supplied directly by the Python source distribution.  The
file is a platform-specific text file.</p>
</dd></dl>

<dl class="function">
<dt id="distutils.sysconfig.get_makefile_filename">
<code class="descclassname">distutils.sysconfig.</code><code class="descname">get_makefile_filename</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#distutils.sysconfig.get_makefile_filename" title="Permalink to this definition">¶</a></dt>
<dd><p>Return the full path name of the <code class="file docutils literal"><span class="pre">Makefile</span></code> used to build Python.  For
Unix, this will be a file generated by the <strong class="program">configure</strong> script; the
meaning for other platforms will vary.  The file is a platform-specific text
file, if it exists. This function is only useful on POSIX platforms.</p>
</dd></dl>

<dl class="function">
<dt id="distutils.sysconfig.get_python_inc">
<code class="descclassname">distutils.sysconfig.</code><code class="descname">get_python_inc</code><span class="sig-paren">(</span><span class="optional">[</span><em>plat_specific</em><span class="optional">[</span>, <em>prefix</em><span class="optional">]</span><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#distutils.sysconfig.get_python_inc" title="Permalink to this definition">¶</a></dt>
<dd><p>Return the directory for either the general or platform-dependent C include
files.  If <em>plat_specific</em> is true, the platform-dependent include directory is
returned; if false or omitted, the platform-independent directory is returned.
If <em>prefix</em> is given, it is used as either the prefix instead of
<a class="reference internal" href="#distutils.sysconfig.PREFIX" title="distutils.sysconfig.PREFIX"><code class="xref py py-const docutils literal"><span class="pre">PREFIX</span></code></a>, or as the exec-prefix instead of <a class="reference internal" href="#distutils.sysconfig.EXEC_PREFIX" title="distutils.sysconfig.EXEC_PREFIX"><code class="xref py py-const docutils literal"><span class="pre">EXEC_PREFIX</span></code></a> if
<em>plat_specific</em> is true.</p>
</dd></dl>

<dl class="function">
<dt id="distutils.sysconfig.get_python_lib">
<code class="descclassname">distutils.sysconfig.</code><code class="descname">get_python_lib</code><span class="sig-paren">(</span><span class="optional">[</span><em>plat_specific</em><span class="optional">[</span>, <em>standard_lib</em><span class="optional">[</span>, <em>prefix</em><span class="optional">]</span><span class="optional">]</span><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#distutils.sysconfig.get_python_lib" title="Permalink to this definition">¶</a></dt>
<dd><p>Return the directory for either the general or platform-dependent library
installation.  If <em>plat_specific</em> is true, the platform-dependent include
directory is returned; if false or omitted, the platform-independent directory
is returned.  If <em>prefix</em> is given, it is used as either the prefix instead of
<a class="reference internal" href="#distutils.sysconfig.PREFIX" title="distutils.sysconfig.PREFIX"><code class="xref py py-const docutils literal"><span class="pre">PREFIX</span></code></a>, or as the exec-prefix instead of <a class="reference internal" href="#distutils.sysconfig.EXEC_PREFIX" title="distutils.sysconfig.EXEC_PREFIX"><code class="xref py py-const docutils literal"><span class="pre">EXEC_PREFIX</span></code></a> if
<em>plat_specific</em> is true.  If <em>standard_lib</em> is true, the directory for the
standard library is returned rather than the directory for the installation of
third-party extensions.</p>
</dd></dl>

<p>The following function is only intended for use within the <a class="reference internal" href="../library/distutils.html#module-distutils" title="distutils: Support for building and installing Python modules into an existing Python installation."><code class="xref py py-mod docutils literal"><span class="pre">distutils</span></code></a>
package.</p>
<dl class="function">
<dt id="distutils.sysconfig.customize_compiler">
<code class="descclassname">distutils.sysconfig.</code><code class="descname">customize_compiler</code><span class="sig-paren">(</span><em>compiler</em><span class="sig-paren">)</span><a class="headerlink" href="#distutils.sysconfig.customize_compiler" title="Permalink to this definition">¶</a></dt>
<dd><p>Do any platform-specific customization of a
<a class="reference internal" href="#distutils.ccompiler.CCompiler" title="distutils.ccompiler.CCompiler"><code class="xref py py-class docutils literal"><span class="pre">distutils.ccompiler.CCompiler</span></code></a> instance.</p>
<p>This function is only needed on Unix at this time, but should be called
consistently to support forward-compatibility.  It inserts the information that
varies across Unix flavors and is stored in Python’s <code class="file docutils literal"><span class="pre">Makefile</span></code>.  This
information includes the selected compiler, compiler and linker options, and the
extension used by the linker for shared objects.</p>
</dd></dl>

<p>This function is even more special-purpose, and should only be used from
Python’s own build procedures.</p>
<dl class="function">
<dt id="distutils.sysconfig.set_python_build">
<code class="descclassname">distutils.sysconfig.</code><code class="descname">set_python_build</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#distutils.sysconfig.set_python_build" title="Permalink to this definition">¶</a></dt>
<dd><p>Inform the <a class="reference internal" href="#module-distutils.sysconfig" title="distutils.sysconfig: Low-level access to configuration information of the Python interpreter."><code class="xref py py-mod docutils literal"><span class="pre">distutils.sysconfig</span></code></a> module that it is being used as part of
the build process for Python.  This changes a lot of relative locations for
files, allowing them to be located in the build area rather than in an installed
Python.</p>
</dd></dl>

</div>
<div class="section" id="module-distutils.text_file">
<span id="distutils-text-file-the-textfile-class"></span><h2>10.21. <a class="reference internal" href="#module-distutils.text_file" title="distutils.text_file: provides the TextFile class, a simple interface to text files"><code class="xref py py-mod docutils literal"><span class="pre">distutils.text_file</span></code></a> — The TextFile class<a class="headerlink" href="#module-distutils.text_file" title="Permalink to this headline">¶</a></h2>
<p>This module provides the <a class="reference internal" href="#distutils.text_file.TextFile" title="distutils.text_file.TextFile"><code class="xref py py-class docutils literal"><span class="pre">TextFile</span></code></a> class, which gives an interface  to
text files that (optionally) takes care of stripping comments, ignoring  blank
lines, and joining lines with backslashes.</p>
<dl class="class">
<dt id="distutils.text_file.TextFile">
<em class="property">class </em><code class="descclassname">distutils.text_file.</code><code class="descname">TextFile</code><span class="sig-paren">(</span><span class="optional">[</span><em>filename=None</em>, <em>file=None</em>, <em>**options</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#distutils.text_file.TextFile" title="Permalink to this definition">¶</a></dt>
<dd><p>This class provides a file-like object that takes care of all  the things you
commonly want to do when processing a text file  that has some line-by-line
syntax: strip comments (as long as <code class="docutils literal"><span class="pre">#</span></code>  is your comment character), skip blank
lines, join adjacent lines by escaping the newline (ie. backslash at end of
line), strip leading and/or trailing whitespace.  All of these are optional and
independently controllable.</p>
<p>The class provides a <a class="reference internal" href="#distutils.text_file.TextFile.warn" title="distutils.text_file.TextFile.warn"><code class="xref py py-meth docutils literal"><span class="pre">warn()</span></code></a> method so you can generate  warning messages
that report physical line number, even if the  logical line in question spans
multiple physical lines.  Also  provides <a class="reference internal" href="#distutils.text_file.TextFile.unreadline" title="distutils.text_file.TextFile.unreadline"><code class="xref py py-meth docutils literal"><span class="pre">unreadline()</span></code></a> for implementing
line-at-a-time lookahead.</p>
<p><a class="reference internal" href="#distutils.text_file.TextFile" title="distutils.text_file.TextFile"><code class="xref py py-class docutils literal"><span class="pre">TextFile</span></code></a> instances are create with either <em>filename</em>, <em>file</em>, or both.
<a class="reference internal" href="../library/exceptions.html#RuntimeError" title="RuntimeError"><code class="xref py py-exc docutils literal"><span class="pre">RuntimeError</span></code></a> is raised if both are <code class="docutils literal"><span class="pre">None</span></code>. <em>filename</em> should be a
string, and <em>file</em> a file object (or something that provides <a class="reference internal" href="../library/readline.html#module-readline" title="readline: GNU readline support for Python. (Unix)"><code class="xref py py-meth docutils literal"><span class="pre">readline()</span></code></a>
and <a class="reference internal" href="#distutils.text_file.TextFile.close" title="distutils.text_file.TextFile.close"><code class="xref py py-meth docutils literal"><span class="pre">close()</span></code></a>  methods).  It is recommended that you supply at least
<em>filename</em>,  so that <a class="reference internal" href="#distutils.text_file.TextFile" title="distutils.text_file.TextFile"><code class="xref py py-class docutils literal"><span class="pre">TextFile</span></code></a> can include it in warning messages.  If
<em>file</em> is not supplied, <a class="reference internal" href="#distutils.text_file.TextFile" title="distutils.text_file.TextFile"><code class="xref py py-class docutils literal"><span class="pre">TextFile</span></code></a> creates its own using the
<a class="reference internal" href="../library/functions.html#open" title="open"><code class="xref py py-func docutils literal"><span class="pre">open()</span></code></a> built-in function.</p>
<p>The options are all boolean, and affect the values returned by <a class="reference internal" href="../library/readline.html#module-readline" title="readline: GNU readline support for Python. (Unix)"><code class="xref py py-meth docutils literal"><span class="pre">readline()</span></code></a></p>
<table border="1" class="docutils">
<colgroup>
<col width="31%" />
<col width="54%" />
<col width="15%" />
</colgroup>
<thead valign="bottom">
<tr class="row-odd"><th class="head">option name</th>
<th class="head">description</th>
<th class="head">default</th>
</tr>
</thead>
<tbody valign="top">
<tr class="row-even"><td><em>strip_comments</em></td>
<td>strip from <code class="docutils literal"><span class="pre">'#'</span></code> to end-of-
line, as well as any
whitespace leading up to the
<code class="docutils literal"><span class="pre">'#'</span></code>—unless it is
escaped by a backslash</td>
<td>true</td>
</tr>
<tr class="row-odd"><td><em>lstrip_ws</em></td>
<td>strip leading whitespace from
each line before returning it</td>
<td>false</td>
</tr>
<tr class="row-even"><td><em>rstrip_ws</em></td>
<td>strip trailing whitespace
(including line terminator!)
from each line before
returning it.</td>
<td>true</td>
</tr>
<tr class="row-odd"><td><em>skip_blanks</em></td>
<td>skip lines that are empty
*after* stripping comments
and whitespace.  (If both
lstrip_ws and rstrip_ws are
false, then some lines may
consist of solely whitespace:
these will *not* be skipped,
even if <em>skip_blanks</em> is
true.)</td>
<td>true</td>
</tr>
<tr class="row-even"><td><em>join_lines</em></td>
<td>if a backslash is the last
non-newline character on a
line after stripping comments
and whitespace, join the
following line to it to form
one logical line; if N
consecutive lines end with a
backslash, then N+1 physical
lines will be joined to form
one logical line.</td>
<td>false</td>
</tr>
<tr class="row-odd"><td><em>collapse_join</em></td>
<td>strip leading whitespace from
lines that are joined to their
predecessor; only matters if
<code class="docutils literal"><span class="pre">(join_lines</span> <span class="pre">and</span> <span class="pre">not</span>
<span class="pre">lstrip_ws)</span></code></td>
<td>false</td>
</tr>
</tbody>
</table>
<p>Note that since <em>rstrip_ws</em> can strip the trailing newline, the semantics of
<a class="reference internal" href="../library/readline.html#module-readline" title="readline: GNU readline support for Python. (Unix)"><code class="xref py py-meth docutils literal"><span class="pre">readline()</span></code></a> must differ from those of the built-in file object’s
<a class="reference internal" href="../library/readline.html#module-readline" title="readline: GNU readline support for Python. (Unix)"><code class="xref py py-meth docutils literal"><span class="pre">readline()</span></code></a> method!  In particular, <a class="reference internal" href="../library/readline.html#module-readline" title="readline: GNU readline support for Python. (Unix)"><code class="xref py py-meth docutils literal"><span class="pre">readline()</span></code></a>  returns <code class="docutils literal"><span class="pre">None</span></code> for
end-of-file: an empty string might just be a  blank line (or an all-whitespace
line), if <em>rstrip_ws</em> is true  but <em>skip_blanks</em> is not.</p>
<dl class="method">
<dt id="distutils.text_file.TextFile.open">
<code class="descname">open</code><span class="sig-paren">(</span><em>filename</em><span class="sig-paren">)</span><a class="headerlink" href="#distutils.text_file.TextFile.open" title="Permalink to this definition">¶</a></dt>
<dd><p>Open a new file <em>filename</em>.  This overrides any <em>file</em> or <em>filename</em>
constructor arguments.</p>
</dd></dl>

<dl class="method">
<dt id="distutils.text_file.TextFile.close">
<code class="descname">close</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#distutils.text_file.TextFile.close" title="Permalink to this definition">¶</a></dt>
<dd><p>Close the current file and forget everything we know about it (including the
filename and the current line number).</p>
</dd></dl>

<dl class="method">
<dt id="distutils.text_file.TextFile.warn">
<code class="descname">warn</code><span class="sig-paren">(</span><em>msg</em><span class="optional">[</span>, <em>line=None</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#distutils.text_file.TextFile.warn" title="Permalink to this definition">¶</a></dt>
<dd><p>Print (to stderr) a warning message tied to the current logical line in the
current file.  If the current logical line in the file spans multiple physical
lines, the warning refers to the whole range, such as <code class="docutils literal"><span class="pre">&quot;lines</span> <span class="pre">3-5&quot;</span></code>.  If
<em>line</em> is supplied,  it overrides the current line number; it may be a list or
tuple  to indicate a range of physical lines, or an integer for a  single
physical line.</p>
</dd></dl>

<dl class="method">
<dt id="distutils.text_file.TextFile.readline">
<code class="descname">readline</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#distutils.text_file.TextFile.readline" title="Permalink to this definition">¶</a></dt>
<dd><p>Read and return a single logical line from the current file (or from an internal
buffer if lines have previously been “unread” with <a class="reference internal" href="#distutils.text_file.TextFile.unreadline" title="distutils.text_file.TextFile.unreadline"><code class="xref py py-meth docutils literal"><span class="pre">unreadline()</span></code></a>).  If the
<em>join_lines</em> option  is true, this may involve reading multiple physical lines
concatenated into a single string.  Updates the current line number,  so calling
<a class="reference internal" href="#distutils.text_file.TextFile.warn" title="distutils.text_file.TextFile.warn"><code class="xref py py-meth docutils literal"><span class="pre">warn()</span></code></a> after <a class="reference internal" href="../library/readline.html#module-readline" title="readline: GNU readline support for Python. (Unix)"><code class="xref py py-meth docutils literal"><span class="pre">readline()</span></code></a> emits a warning  about the physical line(s)
just read.  Returns <code class="docutils literal"><span class="pre">None</span></code> on end-of-file,  since the empty string can occur
if <em>rstrip_ws</em> is true but  <em>strip_blanks</em> is not.</p>
</dd></dl>

<dl class="method">
<dt id="distutils.text_file.TextFile.readlines">
<code class="descname">readlines</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#distutils.text_file.TextFile.readlines" title="Permalink to this definition">¶</a></dt>
<dd><p>Read and return the list of all logical lines remaining in the current file.
This updates the current line number to the last line of the file.</p>
</dd></dl>

<dl class="method">
<dt id="distutils.text_file.TextFile.unreadline">
<code class="descname">unreadline</code><span class="sig-paren">(</span><em>line</em><span class="sig-paren">)</span><a class="headerlink" href="#distutils.text_file.TextFile.unreadline" title="Permalink to this definition">¶</a></dt>
<dd><p>Push <em>line</em> (a string) onto an internal buffer that will be checked by future
<a class="reference internal" href="../library/readline.html#module-readline" title="readline: GNU readline support for Python. (Unix)"><code class="xref py py-meth docutils literal"><span class="pre">readline()</span></code></a> calls.  Handy for implementing a parser with line-at-a-time
lookahead. Note that lines that are “unread” with <a class="reference internal" href="#distutils.text_file.TextFile.unreadline" title="distutils.text_file.TextFile.unreadline"><code class="xref py py-meth docutils literal"><span class="pre">unreadline()</span></code></a> are not
subsequently re-cleansed (whitespace  stripped, or whatever) when read with
<a class="reference internal" href="../library/readline.html#module-readline" title="readline: GNU readline support for Python. (Unix)"><code class="xref py py-meth docutils literal"><span class="pre">readline()</span></code></a>. If multiple calls are made to <a class="reference internal" href="#distutils.text_file.TextFile.unreadline" title="distutils.text_file.TextFile.unreadline"><code class="xref py py-meth docutils literal"><span class="pre">unreadline()</span></code></a> before a call
to <a class="reference internal" href="../library/readline.html#module-readline" title="readline: GNU readline support for Python. (Unix)"><code class="xref py py-meth docutils literal"><span class="pre">readline()</span></code></a>, the lines will be returned most in most recent first order.</p>
</dd></dl>

</dd></dl>

</div>
<div class="section" id="module-distutils.version">
<span id="distutils-version-version-number-classes"></span><h2>10.22. <a class="reference internal" href="#module-distutils.version" title="distutils.version: implements classes that represent module version numbers."><code class="xref py py-mod docutils literal"><span class="pre">distutils.version</span></code></a> — Version number classes<a class="headerlink" href="#module-distutils.version" title="Permalink to this headline">¶</a></h2>
</div>
<div class="section" id="module-distutils.cmd">
<span id="distutils-cmd-abstract-base-class-for-distutils-commands"></span><h2>10.23. <a class="reference internal" href="#module-distutils.cmd" title="distutils.cmd: This module provides the abstract base class Command. This class is subclassed by the modules in the distutils.command subpackage."><code class="xref py py-mod docutils literal"><span class="pre">distutils.cmd</span></code></a> — Abstract base class for Distutils commands<a class="headerlink" href="#module-distutils.cmd" title="Permalink to this headline">¶</a></h2>
<p>This module supplies the abstract base class <a class="reference internal" href="#distutils.cmd.Command" title="distutils.cmd.Command"><code class="xref py py-class docutils literal"><span class="pre">Command</span></code></a>.</p>
<dl class="class">
<dt id="distutils.cmd.Command">
<em class="property">class </em><code class="descclassname">distutils.cmd.</code><code class="descname">Command</code><span class="sig-paren">(</span><em>dist</em><span class="sig-paren">)</span><a class="headerlink" href="#distutils.cmd.Command" title="Permalink to this definition">¶</a></dt>
<dd><p>Abstract base class for defining command classes, the “worker bees” of the
Distutils.  A useful analogy for command classes is to think of them as
subroutines with local variables called <em>options</em>.  The options are declared
in <a class="reference internal" href="#distutils.cmd.Command.initialize_options" title="distutils.cmd.Command.initialize_options"><code class="xref py py-meth docutils literal"><span class="pre">initialize_options()</span></code></a> and defined (given their final values) in
<a class="reference internal" href="#distutils.cmd.Command.finalize_options" title="distutils.cmd.Command.finalize_options"><code class="xref py py-meth docutils literal"><span class="pre">finalize_options()</span></code></a>, both of which must be defined by every command
class.  The distinction between the two is necessary because option values
might come from the outside world (command line, config file, …), and any
options dependent on other options must be computed after these outside
influences have been processed — hence <a class="reference internal" href="#distutils.cmd.Command.finalize_options" title="distutils.cmd.Command.finalize_options"><code class="xref py py-meth docutils literal"><span class="pre">finalize_options()</span></code></a>.  The body
of the subroutine, where it does all its work based on the values of its
options, is the <a class="reference internal" href="#distutils.cmd.Command.run" title="distutils.cmd.Command.run"><code class="xref py py-meth docutils literal"><span class="pre">run()</span></code></a> method, which must also be implemented by every
command class.</p>
<p>The class constructor takes a single argument <em>dist</em>, a
<a class="reference internal" href="#distutils.core.Distribution" title="distutils.core.Distribution"><code class="xref py py-class docutils literal"><span class="pre">Distribution</span></code></a> instance.</p>
</dd></dl>

</div>
<div class="section" id="creating-a-new-distutils-command">
<h2>10.24. Creating a new Distutils command<a class="headerlink" href="#creating-a-new-distutils-command" title="Permalink to this headline">¶</a></h2>
<p>This section outlines the steps to create a new Distutils command.</p>
<p>A new command lives in a module in the <a class="reference internal" href="#module-distutils.command" title="distutils.command: This subpackage contains one module for each standard Distutils command."><code class="xref py py-mod docutils literal"><span class="pre">distutils.command</span></code></a> package. There
is a sample template in that directory called <code class="file docutils literal"><span class="pre">command_template</span></code>.  Copy
this file to a new module with the same name as the new command you’re
implementing.  This module should implement a class with the same name as the
module (and the command).  So, for instance, to create the command
<code class="docutils literal"><span class="pre">peel_banana</span></code> (so that users can run <code class="docutils literal"><span class="pre">setup.py</span> <span class="pre">peel_banana</span></code>), you’d copy
<code class="file docutils literal"><span class="pre">command_template</span></code> to <code class="file docutils literal"><span class="pre">distutils/command/peel_banana.py</span></code>, then edit
it so that it’s implementing the class <code class="xref py py-class docutils literal"><span class="pre">peel_banana</span></code>, a subclass of
<a class="reference internal" href="#distutils.cmd.Command" title="distutils.cmd.Command"><code class="xref py py-class docutils literal"><span class="pre">distutils.cmd.Command</span></code></a>.</p>
<p>Subclasses of <a class="reference internal" href="#distutils.cmd.Command" title="distutils.cmd.Command"><code class="xref py py-class docutils literal"><span class="pre">Command</span></code></a> must define the following methods.</p>
<dl class="method">
<dt id="distutils.cmd.Command.initialize_options">
<code class="descclassname">Command.</code><code class="descname">initialize_options</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#distutils.cmd.Command.initialize_options" title="Permalink to this definition">¶</a></dt>
<dd><p>Set default values for all the options that this command supports.  Note that
these defaults may be overridden by other commands, by the setup script, by
config files, or by the command-line.  Thus, this is not the place to code
dependencies between options; generally, <a class="reference internal" href="#distutils.cmd.Command.initialize_options" title="distutils.cmd.Command.initialize_options"><code class="xref py py-meth docutils literal"><span class="pre">initialize_options()</span></code></a>
implementations are just a bunch of <code class="docutils literal"><span class="pre">self.foo</span> <span class="pre">=</span> <span class="pre">None</span></code> assignments.</p>
</dd></dl>

<dl class="method">
<dt id="distutils.cmd.Command.finalize_options">
<code class="descclassname">Command.</code><code class="descname">finalize_options</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#distutils.cmd.Command.finalize_options" title="Permalink to this definition">¶</a></dt>
<dd><p>Set final values for all the options that this command supports. This is
always called as late as possible, ie.  after any option assignments from the
command-line or from other commands have been done.  Thus, this is the place
to code option dependencies: if <em>foo</em> depends on <em>bar</em>, then it is safe to
set <em>foo</em> from <em>bar</em> as long as <em>foo</em> still has the same value it was
assigned in <a class="reference internal" href="#distutils.cmd.Command.initialize_options" title="distutils.cmd.Command.initialize_options"><code class="xref py py-meth docutils literal"><span class="pre">initialize_options()</span></code></a>.</p>
</dd></dl>

<dl class="method">
<dt id="distutils.cmd.Command.run">
<code class="descclassname">Command.</code><code class="descname">run</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#distutils.cmd.Command.run" title="Permalink to this definition">¶</a></dt>
<dd><p>A command’s raison d’etre: carry out the action it exists to perform, controlled
by the options initialized in <a class="reference internal" href="#distutils.cmd.Command.initialize_options" title="distutils.cmd.Command.initialize_options"><code class="xref py py-meth docutils literal"><span class="pre">initialize_options()</span></code></a>, customized by other
commands, the setup script, the command-line, and config files, and finalized in
<a class="reference internal" href="#distutils.cmd.Command.finalize_options" title="distutils.cmd.Command.finalize_options"><code class="xref py py-meth docutils literal"><span class="pre">finalize_options()</span></code></a>.  All terminal output and filesystem interaction should
be done by <a class="reference internal" href="#distutils.cmd.Command.run" title="distutils.cmd.Command.run"><code class="xref py py-meth docutils literal"><span class="pre">run()</span></code></a>.</p>
</dd></dl>

<dl class="attribute">
<dt id="distutils.cmd.Command.sub_commands">
<code class="descclassname">Command.</code><code class="descname">sub_commands</code><a class="headerlink" href="#distutils.cmd.Command.sub_commands" title="Permalink to this definition">¶</a></dt>
<dd><p><em>sub_commands</em> formalizes the notion of a “family” of commands,
e.g. <code class="docutils literal"><span class="pre">install</span></code> as the parent with sub-commands <code class="docutils literal"><span class="pre">install_lib</span></code>,
<code class="docutils literal"><span class="pre">install_headers</span></code>, etc.  The parent of a family of commands defines
<em>sub_commands</em> as a class attribute; it’s a list of 2-tuples <code class="docutils literal"><span class="pre">(command_name,</span>
<span class="pre">predicate)</span></code>, with <em>command_name</em> a string and <em>predicate</em> a function, a
string or <code class="docutils literal"><span class="pre">None</span></code>.  <em>predicate</em> is a method of the parent command that
determines whether the corresponding command is applicable in the current
situation.  (E.g. <code class="docutils literal"><span class="pre">install_headers</span></code> is only applicable if we have any C
header files to install.)  If <em>predicate</em> is <code class="docutils literal"><span class="pre">None</span></code>, that command is always
applicable.</p>
<p><em>sub_commands</em> is usually defined at the <em>end</em> of a class, because
predicates can be methods of the class, so they must already have been
defined.  The canonical example is the <strong class="command">install</strong> command.</p>
</dd></dl>

</div>
<div class="section" id="module-distutils.command">
<span id="distutils-command-individual-distutils-commands"></span><h2>10.25. <a class="reference internal" href="#module-distutils.command" title="distutils.command: This subpackage contains one module for each standard Distutils command."><code class="xref py py-mod docutils literal"><span class="pre">distutils.command</span></code></a> — Individual Distutils commands<a class="headerlink" href="#module-distutils.command" title="Permalink to this headline">¶</a></h2>
</div>
<div class="section" id="module-distutils.command.bdist">
<span id="distutils-command-bdist-build-a-binary-installer"></span><h2>10.26. <a class="reference internal" href="#module-distutils.command.bdist" title="distutils.command.bdist: Build a binary installer for a package"><code class="xref py py-mod docutils literal"><span class="pre">distutils.command.bdist</span></code></a> — Build a binary installer<a class="headerlink" href="#module-distutils.command.bdist" title="Permalink to this headline">¶</a></h2>
</div>
<div class="section" id="module-distutils.command.bdist_packager">
<span id="distutils-command-bdist-packager-abstract-base-class-for-packagers"></span><h2>10.27. <a class="reference internal" href="#module-distutils.command.bdist_packager" title="distutils.command.bdist_packager: Abstract base class for packagers"><code class="xref py py-mod docutils literal"><span class="pre">distutils.command.bdist_packager</span></code></a> — Abstract base class for packagers<a class="headerlink" href="#module-distutils.command.bdist_packager" title="Permalink to this headline">¶</a></h2>
</div>
<div class="section" id="module-distutils.command.bdist_dumb">
<span id="distutils-command-bdist-dumb-build-a-dumb-installer"></span><h2>10.28. <a class="reference internal" href="#module-distutils.command.bdist_dumb" title="distutils.command.bdist_dumb: Build a &quot;dumb&quot; installer - a simple archive of files"><code class="xref py py-mod docutils literal"><span class="pre">distutils.command.bdist_dumb</span></code></a> — Build a “dumb” installer<a class="headerlink" href="#module-distutils.command.bdist_dumb" title="Permalink to this headline">¶</a></h2>
</div>
<div class="section" id="module-distutils.command.bdist_msi">
<span id="distutils-command-bdist-msi-build-a-microsoft-installer-binary-package"></span><h2>10.29. <a class="reference internal" href="#module-distutils.command.bdist_msi" title="distutils.command.bdist_msi: Build a binary distribution as a Windows MSI file"><code class="xref py py-mod docutils literal"><span class="pre">distutils.command.bdist_msi</span></code></a> — Build a Microsoft Installer binary package<a class="headerlink" href="#module-distutils.command.bdist_msi" title="Permalink to this headline">¶</a></h2>
<dl class="class">
<dt id="distutils.command.bdist_msi.bdist_msi">
<em class="property">class </em><code class="descclassname">distutils.command.bdist_msi.</code><code class="descname">bdist_msi</code><a class="headerlink" href="#distutils.command.bdist_msi.bdist_msi" title="Permalink to this definition">¶</a></dt>
<dd><p>Builds a <a class="reference external" href="https://msdn.microsoft.com/en-us/library/cc185688(VS.85).aspx">Windows Installer</a> (.msi) binary package.</p>
<p>In most cases, the <code class="docutils literal"><span class="pre">bdist_msi</span></code> installer is a better choice than the
<code class="docutils literal"><span class="pre">bdist_wininst</span></code> installer, because it provides better support for
Win64 platforms, allows administrators to perform non-interactive
installations, and allows installation through group policies.</p>
</dd></dl>

</div>
<div class="section" id="module-distutils.command.bdist_rpm">
<span id="distutils-command-bdist-rpm-build-a-binary-distribution-as-a-redhat-rpm-and-srpm"></span><h2>10.30. <a class="reference internal" href="#module-distutils.command.bdist_rpm" title="distutils.command.bdist_rpm: Build a binary distribution as a Redhat RPM and SRPM"><code class="xref py py-mod docutils literal"><span class="pre">distutils.command.bdist_rpm</span></code></a> — Build a binary distribution as a Redhat RPM and SRPM<a class="headerlink" href="#module-distutils.command.bdist_rpm" title="Permalink to this headline">¶</a></h2>
</div>
<div class="section" id="module-distutils.command.bdist_wininst">
<span id="distutils-command-bdist-wininst-build-a-windows-installer"></span><h2>10.31. <a class="reference internal" href="#module-distutils.command.bdist_wininst" title="distutils.command.bdist_wininst: Build a Windows installer"><code class="xref py py-mod docutils literal"><span class="pre">distutils.command.bdist_wininst</span></code></a> — Build a Windows installer<a class="headerlink" href="#module-distutils.command.bdist_wininst" title="Permalink to this headline">¶</a></h2>
</div>
<div class="section" id="module-distutils.command.sdist">
<span id="distutils-command-sdist-build-a-source-distribution"></span><h2>10.32. <a class="reference internal" href="#module-distutils.command.sdist" title="distutils.command.sdist: Build a source distribution"><code class="xref py py-mod docutils literal"><span class="pre">distutils.command.sdist</span></code></a> — Build a source distribution<a class="headerlink" href="#module-distutils.command.sdist" title="Permalink to this headline">¶</a></h2>
</div>
<div class="section" id="module-distutils.command.build">
<span id="distutils-command-build-build-all-files-of-a-package"></span><h2>10.33. <a class="reference internal" href="#module-distutils.command.build" title="distutils.command.build: Build all files of a package"><code class="xref py py-mod docutils literal"><span class="pre">distutils.command.build</span></code></a> — Build all files of a package<a class="headerlink" href="#module-distutils.command.build" title="Permalink to this headline">¶</a></h2>
</div>
<div class="section" id="module-distutils.command.build_clib">
<span id="distutils-command-build-clib-build-any-c-libraries-in-a-package"></span><h2>10.34. <a class="reference internal" href="#module-distutils.command.build_clib" title="distutils.command.build_clib: Build any C libraries in a package"><code class="xref py py-mod docutils literal"><span class="pre">distutils.command.build_clib</span></code></a> — Build any C libraries in a package<a class="headerlink" href="#module-distutils.command.build_clib" title="Permalink to this headline">¶</a></h2>
</div>
<div class="section" id="module-distutils.command.build_ext">
<span id="distutils-command-build-ext-build-any-extensions-in-a-package"></span><h2>10.35. <a class="reference internal" href="#module-distutils.command.build_ext" title="distutils.command.build_ext: Build any extensions in a package"><code class="xref py py-mod docutils literal"><span class="pre">distutils.command.build_ext</span></code></a> — Build any extensions in a package<a class="headerlink" href="#module-distutils.command.build_ext" title="Permalink to this headline">¶</a></h2>
</div>
<div class="section" id="module-distutils.command.build_py">
<span id="distutils-command-build-py-build-the-py-pyc-files-of-a-package"></span><h2>10.36. <a class="reference internal" href="#module-distutils.command.build_py" title="distutils.command.build_py: Build the .py/.pyc files of a package"><code class="xref py py-mod docutils literal"><span class="pre">distutils.command.build_py</span></code></a> — Build the .py/.pyc files of a package<a class="headerlink" href="#module-distutils.command.build_py" title="Permalink to this headline">¶</a></h2>
<dl class="class">
<dt id="distutils.command.build_py.build_py">
<em class="property">class </em><code class="descclassname">distutils.command.build_py.</code><code class="descname">build_py</code><a class="headerlink" href="#distutils.command.build_py.build_py" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="class">
<dt id="distutils.command.build_py.build_py_2to3">
<em class="property">class </em><code class="descclassname">distutils.command.build_py.</code><code class="descname">build_py_2to3</code><a class="headerlink" href="#distutils.command.build_py.build_py_2to3" title="Permalink to this definition">¶</a></dt>
<dd><p>Alternative implementation of build_py which also runs the
2to3 conversion library on each .py file that is going to be
installed. To use this in a setup.py file for a distribution
that is designed to run with both Python 2.x and 3.x, add:</p>
<div class="highlight-python3"><div class="highlight"><pre><span></span><span class="k">try</span><span class="p">:</span>
    <span class="kn">from</span> <span class="nn">distutils.command.build_py</span> <span class="k">import</span> <span class="n">build_py_2to3</span> <span class="k">as</span> <span class="n">build_py</span>
<span class="k">except</span> <span class="ne">ImportError</span><span class="p">:</span>
    <span class="kn">from</span> <span class="nn">distutils.command.build_py</span> <span class="k">import</span> <span class="n">build_py</span>
</pre></div>
</div>
<p>to your setup.py, and later:</p>
<div class="highlight-python3"><div class="highlight"><pre><span></span><span class="n">cmdclass</span> <span class="o">=</span> <span class="p">{</span><span class="s1">&#39;build_py&#39;</span><span class="p">:</span> <span class="n">build_py</span><span class="p">}</span>
</pre></div>
</div>
<p>to the invocation of setup().</p>
</dd></dl>

</div>
<div class="section" id="module-distutils.command.build_scripts">
<span id="distutils-command-build-scripts-build-the-scripts-of-a-package"></span><h2>10.37. <a class="reference internal" href="#module-distutils.command.build_scripts" title="distutils.command.build_scripts: Build the scripts of a package"><code class="xref py py-mod docutils literal"><span class="pre">distutils.command.build_scripts</span></code></a> — Build the scripts of a package<a class="headerlink" href="#module-distutils.command.build_scripts" title="Permalink to this headline">¶</a></h2>
</div>
<div class="section" id="module-distutils.command.clean">
<span id="distutils-command-clean-clean-a-package-build-area"></span><h2>10.38. <a class="reference internal" href="#module-distutils.command.clean" title="distutils.command.clean: Clean a package build area"><code class="xref py py-mod docutils literal"><span class="pre">distutils.command.clean</span></code></a> — Clean a package build area<a class="headerlink" href="#module-distutils.command.clean" title="Permalink to this headline">¶</a></h2>
<p>This command removes the temporary files created by <strong class="command">build</strong>
and its subcommands, like intermediary compiled object files.  With
the <code class="docutils literal"><span class="pre">--all</span></code> option, the complete build directory will be removed.</p>
<p>Extension modules built <a class="reference internal" href="configfile.html#distutils-build-ext-inplace"><span class="std std-ref">in place</span></a>
will not be cleaned, as they are not in the build directory.</p>
</div>
<div class="section" id="module-distutils.command.config">
<span id="distutils-command-config-perform-package-configuration"></span><h2>10.39. <a class="reference internal" href="#module-distutils.command.config" title="distutils.command.config: Perform package configuration"><code class="xref py py-mod docutils literal"><span class="pre">distutils.command.config</span></code></a> — Perform package configuration<a class="headerlink" href="#module-distutils.command.config" title="Permalink to this headline">¶</a></h2>
</div>
<div class="section" id="module-distutils.command.install">
<span id="distutils-command-install-install-a-package"></span><h2>10.40. <a class="reference internal" href="#module-distutils.command.install" title="distutils.command.install: Install a package"><code class="xref py py-mod docutils literal"><span class="pre">distutils.command.install</span></code></a> — Install a package<a class="headerlink" href="#module-distutils.command.install" title="Permalink to this headline">¶</a></h2>
</div>
<div class="section" id="module-distutils.command.install_data">
<span id="distutils-command-install-data-install-data-files-from-a-package"></span><h2>10.41. <a class="reference internal" href="#module-distutils.command.install_data" title="distutils.command.install_data: Install data files from a package"><code class="xref py py-mod docutils literal"><span class="pre">distutils.command.install_data</span></code></a> — Install data files from a package<a class="headerlink" href="#module-distutils.command.install_data" title="Permalink to this headline">¶</a></h2>
</div>
<div class="section" id="module-distutils.command.install_headers">
<span id="distutils-command-install-headers-install-c-c-header-files-from-a-package"></span><h2>10.42. <a class="reference internal" href="#module-distutils.command.install_headers" title="distutils.command.install_headers: Install C/C++ header files from a package"><code class="xref py py-mod docutils literal"><span class="pre">distutils.command.install_headers</span></code></a> — Install C/C++ header files from a package<a class="headerlink" href="#module-distutils.command.install_headers" title="Permalink to this headline">¶</a></h2>
</div>
<div class="section" id="module-distutils.command.install_lib">
<span id="distutils-command-install-lib-install-library-files-from-a-package"></span><h2>10.43. <a class="reference internal" href="#module-distutils.command.install_lib" title="distutils.command.install_lib: Install library files from a package"><code class="xref py py-mod docutils literal"><span class="pre">distutils.command.install_lib</span></code></a> — Install library files from a package<a class="headerlink" href="#module-distutils.command.install_lib" title="Permalink to this headline">¶</a></h2>
</div>
<div class="section" id="module-distutils.command.install_scripts">
<span id="distutils-command-install-scripts-install-script-files-from-a-package"></span><h2>10.44. <a class="reference internal" href="#module-distutils.command.install_scripts" title="distutils.command.install_scripts: Install script files from a package"><code class="xref py py-mod docutils literal"><span class="pre">distutils.command.install_scripts</span></code></a> — Install script files from a package<a class="headerlink" href="#module-distutils.command.install_scripts" title="Permalink to this headline">¶</a></h2>
</div>
<div class="section" id="module-distutils.command.register">
<span id="distutils-command-register-register-a-module-with-the-python-package-index"></span><h2>10.45. <a class="reference internal" href="#module-distutils.command.register" title="distutils.command.register: Register a module with the Python Package Index"><code class="xref py py-mod docutils literal"><span class="pre">distutils.command.register</span></code></a> — Register a module with the Python Package Index<a class="headerlink" href="#module-distutils.command.register" title="Permalink to this headline">¶</a></h2>
<p>The <code class="docutils literal"><span class="pre">register</span></code> command registers the package with the Python Package  Index.
This is described in more detail in <span class="target" id="index-7"></span><a class="pep reference external" href="https://www.python.org/dev/peps/pep-0301"><strong>PEP 301</strong></a>.</p>
</div>
<div class="section" id="module-distutils.command.check">
<span id="distutils-command-check-check-the-meta-data-of-a-package"></span><h2>10.46. <a class="reference internal" href="#module-distutils.command.check" title="distutils.command.check: Check the metadata of a package"><code class="xref py py-mod docutils literal"><span class="pre">distutils.command.check</span></code></a> — Check the meta-data of a package<a class="headerlink" href="#module-distutils.command.check" title="Permalink to this headline">¶</a></h2>
<p>The <code class="docutils literal"><span class="pre">check</span></code> command performs some tests on the meta-data of a package.
For example, it verifies that all required meta-data are provided as
the arguments passed to the <code class="xref py py-func docutils literal"><span class="pre">setup()</span></code> function.</p>
</div>
</div>


          </div>
        </div>
      </div>
      <div class="sphinxsidebar" role="navigation" aria-label="main navigation">
        <div class="sphinxsidebarwrapper">
  <h3><a href="../contents.html">Table Of Contents</a></h3>
  <ul>
<li><a class="reference internal" href="#">10. API Reference</a><ul>
<li><a class="reference internal" href="#module-distutils.core">10.1. <code class="docutils literal"><span class="pre">distutils.core</span></code> — Core Distutils functionality</a></li>
<li><a class="reference internal" href="#module-distutils.ccompiler">10.2. <code class="docutils literal"><span class="pre">distutils.ccompiler</span></code> — CCompiler base class</a></li>
<li><a class="reference internal" href="#module-distutils.unixccompiler">10.3. <code class="docutils literal"><span class="pre">distutils.unixccompiler</span></code> — Unix C Compiler</a></li>
<li><a class="reference internal" href="#module-distutils.msvccompiler">10.4. <code class="docutils literal"><span class="pre">distutils.msvccompiler</span></code> — Microsoft Compiler</a></li>
<li><a class="reference internal" href="#module-distutils.bcppcompiler">10.5. <code class="docutils literal"><span class="pre">distutils.bcppcompiler</span></code> — Borland Compiler</a></li>
<li><a class="reference internal" href="#module-distutils.cygwinccompiler">10.6. <code class="docutils literal"><span class="pre">distutils.cygwincompiler</span></code> — Cygwin Compiler</a></li>
<li><a class="reference internal" href="#module-distutils.archive_util">10.7. <code class="docutils literal"><span class="pre">distutils.archive_util</span></code> —  Archiving utilities</a></li>
<li><a class="reference internal" href="#module-distutils.dep_util">10.8. <code class="docutils literal"><span class="pre">distutils.dep_util</span></code> — Dependency checking</a></li>
<li><a class="reference internal" href="#module-distutils.dir_util">10.9. <code class="docutils literal"><span class="pre">distutils.dir_util</span></code> — Directory tree operations</a></li>
<li><a class="reference internal" href="#module-distutils.file_util">10.10. <code class="docutils literal"><span class="pre">distutils.file_util</span></code> — Single file operations</a></li>
<li><a class="reference internal" href="#module-distutils.util">10.11. <code class="docutils literal"><span class="pre">distutils.util</span></code> — Miscellaneous other utility functions</a></li>
<li><a class="reference internal" href="#module-distutils.dist">10.12. <code class="docutils literal"><span class="pre">distutils.dist</span></code> — The Distribution class</a></li>
<li><a class="reference internal" href="#module-distutils.extension">10.13. <code class="docutils literal"><span class="pre">distutils.extension</span></code> — The Extension class</a></li>
<li><a class="reference internal" href="#module-distutils.debug">10.14. <code class="docutils literal"><span class="pre">distutils.debug</span></code> — Distutils debug mode</a></li>
<li><a class="reference internal" href="#module-distutils.errors">10.15. <code class="docutils literal"><span class="pre">distutils.errors</span></code> — Distutils exceptions</a></li>
<li><a class="reference internal" href="#module-distutils.fancy_getopt">10.16. <code class="docutils literal"><span class="pre">distutils.fancy_getopt</span></code> — Wrapper around the standard getopt module</a></li>
<li><a class="reference internal" href="#module-distutils.filelist">10.17. <code class="docutils literal"><span class="pre">distutils.filelist</span></code> — The FileList class</a></li>
<li><a class="reference internal" href="#module-distutils.log">10.18. <code class="docutils literal"><span class="pre">distutils.log</span></code> — Simple PEP 282-style logging</a></li>
<li><a class="reference internal" href="#module-distutils.spawn">10.19. <code class="docutils literal"><span class="pre">distutils.spawn</span></code> — Spawn a sub-process</a></li>
<li><a class="reference internal" href="#module-distutils.sysconfig">10.20. <code class="docutils literal"><span class="pre">distutils.sysconfig</span></code> — System configuration information</a></li>
<li><a class="reference internal" href="#module-distutils.text_file">10.21. <code class="docutils literal"><span class="pre">distutils.text_file</span></code> — The TextFile class</a></li>
<li><a class="reference internal" href="#module-distutils.version">10.22. <code class="docutils literal"><span class="pre">distutils.version</span></code> — Version number classes</a></li>
<li><a class="reference internal" href="#module-distutils.cmd">10.23. <code class="docutils literal"><span class="pre">distutils.cmd</span></code> — Abstract base class for Distutils commands</a></li>
<li><a class="reference internal" href="#creating-a-new-distutils-command">10.24. Creating a new Distutils command</a></li>
<li><a class="reference internal" href="#module-distutils.command">10.25. <code class="docutils literal"><span class="pre">distutils.command</span></code> — Individual Distutils commands</a></li>
<li><a class="reference internal" href="#module-distutils.command.bdist">10.26. <code class="docutils literal"><span class="pre">distutils.command.bdist</span></code> — Build a binary installer</a></li>
<li><a class="reference internal" href="#module-distutils.command.bdist_packager">10.27. <code class="docutils literal"><span class="pre">distutils.command.bdist_packager</span></code> — Abstract base class for packagers</a></li>
<li><a class="reference internal" href="#module-distutils.command.bdist_dumb">10.28. <code class="docutils literal"><span class="pre">distutils.command.bdist_dumb</span></code> — Build a “dumb” installer</a></li>
<li><a class="reference internal" href="#module-distutils.command.bdist_msi">10.29. <code class="docutils literal"><span class="pre">distutils.command.bdist_msi</span></code> — Build a Microsoft Installer binary package</a></li>
<li><a class="reference internal" href="#module-distutils.command.bdist_rpm">10.30. <code class="docutils literal"><span class="pre">distutils.command.bdist_rpm</span></code> — Build a binary distribution as a Redhat RPM and SRPM</a></li>
<li><a class="reference internal" href="#module-distutils.command.bdist_wininst">10.31. <code class="docutils literal"><span class="pre">distutils.command.bdist_wininst</span></code> — Build a Windows installer</a></li>
<li><a class="reference internal" href="#module-distutils.command.sdist">10.32. <code class="docutils literal"><span class="pre">distutils.command.sdist</span></code> — Build a source distribution</a></li>
<li><a class="reference internal" href="#module-distutils.command.build">10.33. <code class="docutils literal"><span class="pre">distutils.command.build</span></code> — Build all files of a package</a></li>
<li><a class="reference internal" href="#module-distutils.command.build_clib">10.34. <code class="docutils literal"><span class="pre">distutils.command.build_clib</span></code> — Build any C libraries in a package</a></li>
<li><a class="reference internal" href="#module-distutils.command.build_ext">10.35. <code class="docutils literal"><span class="pre">distutils.command.build_ext</span></code> — Build any extensions in a package</a></li>
<li><a class="reference internal" href="#module-distutils.command.build_py">10.36. <code class="docutils literal"><span class="pre">distutils.command.build_py</span></code> — Build the .py/.pyc files of a package</a></li>
<li><a class="reference internal" href="#module-distutils.command.build_scripts">10.37. <code class="docutils literal"><span class="pre">distutils.command.build_scripts</span></code> — Build the scripts of a package</a></li>
<li><a class="reference internal" href="#module-distutils.command.clean">10.38. <code class="docutils literal"><span class="pre">distutils.command.clean</span></code> — Clean a package build area</a></li>
<li><a class="reference internal" href="#module-distutils.command.config">10.39. <code class="docutils literal"><span class="pre">distutils.command.config</span></code> — Perform package configuration</a></li>
<li><a class="reference internal" href="#module-distutils.command.install">10.40. <code class="docutils literal"><span class="pre">distutils.command.install</span></code> — Install a package</a></li>
<li><a class="reference internal" href="#module-distutils.command.install_data">10.41. <code class="docutils literal"><span class="pre">distutils.command.install_data</span></code> — Install data files from a package</a></li>
<li><a class="reference internal" href="#module-distutils.command.install_headers">10.42. <code class="docutils literal"><span class="pre">distutils.command.install_headers</span></code> — Install C/C++ header files from a package</a></li>
<li><a class="reference internal" href="#module-distutils.command.install_lib">10.43. <code class="docutils literal"><span class="pre">distutils.command.install_lib</span></code> — Install library files from a package</a></li>
<li><a class="reference internal" href="#module-distutils.command.install_scripts">10.44. <code class="docutils literal"><span class="pre">distutils.command.install_scripts</span></code> — Install script files from a package</a></li>
<li><a class="reference internal" href="#module-distutils.command.register">10.45. <code class="docutils literal"><span class="pre">distutils.command.register</span></code> — Register a module with the Python Package Index</a></li>
<li><a class="reference internal" href="#module-distutils.command.check">10.46. <code class="docutils literal"><span class="pre">distutils.command.check</span></code> — Check the meta-data of a package</a></li>
</ul>
</li>
</ul>

  <h4>Previous topic</h4>
  <p class="topless"><a href="commandref.html"
                        title="previous chapter">9. Command Reference</a></p>
  <h4>Next topic</h4>
  <p class="topless"><a href="../install/index.html"
                        title="next chapter">Installing Python Modules (Legacy version)</a></p>
  <div role="note" aria-label="source link">
    <h3>This Page</h3>
    <ul class="this-page-menu">
      <li><a href="../bugs.html">Report a Bug</a></li>
      <li>
        <a href="https://github.com/python/cpython/blob/3.6/Doc/distutils/apiref.rst"
            rel="nofollow">Show Source
        </a>
      </li>
    </ul>
  </div>
        </div>
      </div>
      <div class="clearer"></div>
    </div>  
    <div class="related" role="navigation" aria-label="related navigation">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="../genindex.html" title="General Index"
             >index</a></li>
        <li class="right" >
          <a href="../py-modindex.html" title="Python Module Index"
             >modules</a> |</li>
        <li class="right" >
          <a href="../install/index.html" title="Installing Python Modules (Legacy version)"
             >next</a> |</li>
        <li class="right" >
          <a href="commandref.html" title="9. Command Reference"
             >previous</a> |</li>
        <li><img src="../_static/py.png" alt=""
                 style="vertical-align: middle; margin-top: -1px"/></li>
        <li><a href="https://www.python.org/">Python</a> &#187;</li>
        <li>
          <span class="language_switcher_placeholder">en</span>
          <span class="version_switcher_placeholder">3.6.3</span>
          <a href="../index.html">Documentation </a> &#187;
        </li>

          <li class="nav-item nav-item-1"><a href="index.html" >Distributing Python Modules (Legacy version)</a> &#187;</li>
    <li class="right">
        

    <div class="inline-search" style="display: none" role="search">
        <form class="inline-search" action="../search.html" method="get">
          <input placeholder="Quick search" type="text" name="q" />
          <input type="submit" value="Go" />
          <input type="hidden" name="check_keywords" value="yes" />
          <input type="hidden" name="area" value="default" />
        </form>
    </div>
    <script type="text/javascript">$('.inline-search').show(0);</script>
         |
    </li>

      </ul>
    </div>  
    <div class="footer">
    &copy; <a href="../copyright.html">Copyright</a> 2001-2017, Python Software Foundation.
    <br />
    The Python Software Foundation is a non-profit corporation.
    <a href="https://www.python.org/psf/donations/">Please donate.</a>
    <br />
    Last updated on Oct 14, 2017.
    <a href="../bugs.html">Found a bug</a>?
    <br />
    Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.6.4.
    </div>

  </body>
</html>